Skip to content
Snippets Groups Projects
Commit 5a37462d authored by Simon McVittie's avatar Simon McVittie
Browse files

utils: Don't consider exit status 255 to be signal 127


Linux has 64 signals, numbered 1 to 64, of which signals 32 to 64
inclusive are the POSIX real-time signals. Older Linux versions had
31 signals, numbered 1 to 31.

Some utilities, like old versions of vulkaninfo(1), use exit(-1) to
signal errors. This really results in exit status (unsigned char)(-1),
or 255, which timeout(1) passes through as-is. This can't be
128 + a signal number, because there aren't that many signals in
practice. Stop interpreting exit statuses as signals after
128+SIGRTMAX (in practice 128+64) instead.

Signed-off-by: default avatarSimon McVittie <smcv@collabora.com>
parent 0c6fe333
No related branches found
No related tags found
1 merge request!91utils: Don't consider exit status 255 to be signal 127
Pipeline #2116 passed
...@@ -178,7 +178,7 @@ _srt_process_timeout_wait_status (int wait_status, int *exit_status, int *termin ...@@ -178,7 +178,7 @@ _srt_process_timeout_wait_status (int wait_status, int *exit_status, int *termin
{ {
*exit_status = WEXITSTATUS (wait_status); *exit_status = WEXITSTATUS (wait_status);
if (*exit_status > 128) if (*exit_status > 128 && *exit_status <= 128 + SIGRTMAX)
{ {
g_debug ("-> killed by signal %d", (*exit_status - 128)); g_debug ("-> killed by signal %d", (*exit_status - 128));
*terminating_signal = (*exit_status - 128); *terminating_signal = (*exit_status - 128);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment