diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-04 11:37:09 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2010-01-04 11:37:09 +0100 |
commit | a4899efd03d2fdaaf3f581d89a7a4844832d3fbb (patch) | |
tree | 8fab20ee4e6503866945de3bb400eadf9618b7ac /shell/hush.c | |
parent | 4168fdd8e6f5ad4d41a30a2350dbd635cc0fa6e1 (diff) | |
download | busybox-w32-a4899efd03d2fdaaf3f581d89a7a4844832d3fbb.tar.gz busybox-w32-a4899efd03d2fdaaf3f581d89a7a4844832d3fbb.tar.bz2 busybox-w32-a4899efd03d2fdaaf3f581d89a7a4844832d3fbb.zip |
hush: fix exitcodes of killed processes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell/hush.c')
-rw-r--r-- | shell/hush.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/shell/hush.c b/shell/hush.c index 3044024a0..25094654d 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
@@ -3896,9 +3896,7 @@ static int checkjobs(struct pipe* fg_pipe) | |||
3896 | fg_pipe->alive_cmds--; | 3896 | fg_pipe->alive_cmds--; |
3897 | if (i == fg_pipe->num_cmds - 1) { | 3897 | if (i == fg_pipe->num_cmds - 1) { |
3898 | /* last process gives overall exitstatus */ | 3898 | /* last process gives overall exitstatus */ |
3899 | /* Note: is WIFSIGNALED, WEXITSTATUS = sig + 128 */ | ||
3900 | rcode = WEXITSTATUS(status); | 3899 | rcode = WEXITSTATUS(status); |
3901 | IF_HAS_KEYWORDS(if (fg_pipe->pi_inverted) rcode = !rcode;) | ||
3902 | /* bash prints killer signal's name for *last* | 3900 | /* bash prints killer signal's name for *last* |
3903 | * process in pipe (prints just newline for SIGINT). | 3901 | * process in pipe (prints just newline for SIGINT). |
3904 | * Mimic this. Example: "sleep 5" + (^\ or kill -QUIT) | 3902 | * Mimic this. Example: "sleep 5" + (^\ or kill -QUIT) |
@@ -3906,7 +3904,11 @@ static int checkjobs(struct pipe* fg_pipe) | |||
3906 | if (WIFSIGNALED(status)) { | 3904 | if (WIFSIGNALED(status)) { |
3907 | int sig = WTERMSIG(status); | 3905 | int sig = WTERMSIG(status); |
3908 | printf("%s\n", sig == SIGINT ? "" : get_signame(sig)); | 3906 | printf("%s\n", sig == SIGINT ? "" : get_signame(sig)); |
3907 | /* TODO: MIPS has 128 sigs (1..128), what if sig==128 here? | ||
3908 | * Maybe we need to use sig | 128? */ | ||
3909 | rcode = sig + 128; | ||
3909 | } | 3910 | } |
3911 | IF_HAS_KEYWORDS(if (fg_pipe->pi_inverted) rcode = !rcode;) | ||
3910 | } | 3912 | } |
3911 | } else { | 3913 | } else { |
3912 | fg_pipe->cmds[i].is_stopped = 1; | 3914 | fg_pipe->cmds[i].is_stopped = 1; |