From 5a37462d644cf7a5d80f20ef6515764492c47079 Mon Sep 17 00:00:00 2001 From: Simon McVittie <smcv@collabora.com> Date: Mon, 9 Dec 2019 17:08:26 +0000 Subject: [PATCH] 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: Simon McVittie <smcv@collabora.com> --- steam-runtime-tools/utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steam-runtime-tools/utils.c b/steam-runtime-tools/utils.c index 0440ceb70..a9b708da9 100644 --- a/steam-runtime-tools/utils.c +++ b/steam-runtime-tools/utils.c @@ -178,7 +178,7 @@ _srt_process_timeout_wait_status (int wait_status, int *exit_status, int *termin { *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)); *terminating_signal = (*exit_status - 128); -- GitLab