From a3822de23e8d2b1c173eab6925676de54c38b6f2 Mon Sep 17 00:00:00 2001 From: Glenn L McGrath Date: Mon, 15 Sep 2003 14:42:39 +0000 Subject: Patch from Bastian Blank to fix a problem when runing find under ash. "If the shell is compiled with -DJOBS, this is all fine -- find wasn't stopped (it was killed), so it correctly uses WTERMSIG instead of WSTOPSIG. However, if the shell _isn't_ compiled with -DJOBS (which it isn't in d-i), only WSTOPSIG is used, which extracts the high byte instead of the low byte from the status code. Since the status code is 13 (SIGPIPE), "st" suddenly gets the value 0, which is equivalent to SIGEXIT. Thus, ash prints out "EXIT" on find's exit." --- shell/ash.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'shell') diff --git a/shell/ash.c b/shell/ash.c index 2146349ab..0cdfd2b1c 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -6683,10 +6683,10 @@ sprint_status(char *s, int status, int sigonly) col = 0; st = WEXITSTATUS(status); if (!WIFEXITED(status)) { - st = WSTOPSIG(status); + st = WTERMSIG(status); #if JOBS - if (!WIFSTOPPED(status)) - st = WTERMSIG(status); + if (WIFSTOPPED(status)) + st = WSTOPSIG(status); #endif if (sigonly) { if (st == SIGINT || st == SIGPIPE) -- cgit v1.2.3