diff options
author | Ron Yorston <rmy@pobox.com> | 2021-09-21 12:52:24 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2021-09-21 13:24:00 +0100 |
commit | df34f5e92b1d10f0bb858d2ea6e8c249e87ac593 (patch) | |
tree | f90208eb2d6f3710833958f67e6101fc2fa85806 /shell | |
parent | 48ddce5e9a063d89689ffe4be1680767186e13ee (diff) | |
download | busybox-w32-df34f5e92b1d10f0bb858d2ea6e8c249e87ac593.tar.gz busybox-w32-df34f5e92b1d10f0bb858d2ea6e8c249e87ac593.tar.bz2 busybox-w32-df34f5e92b1d10f0bb858d2ea6e8c249e87ac593.zip |
ash: improve signal handling
Allow waitpid() to detect SIGTERM/SIGKILL by checking the (Windows)
status returned by GetExitCodeProcess() and updating the Unix
status to suit. This allows ash to detect when a process has been
'signalled'.
Provide our own implementation of strsignal(3) which returns
expanded text for SIGTERM/SIGKILL.
Costs 192 bytes.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ash.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/shell/ash.c b/shell/ash.c index f91cd7e1f..613bb97a0 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -4835,6 +4835,8 @@ waitpid_child(int *status, int wait_flags) | |||
4835 | if (idx < pid_nr) { | 4835 | if (idx < pid_nr) { |
4836 | GetExitCodeProcess(proclist[idx], &win_status); | 4836 | GetExitCodeProcess(proclist[idx], &win_status); |
4837 | *status = (int)win_status << 8; | 4837 | *status = (int)win_status << 8; |
4838 | if (win_status == 128 + SIGTERM || win_status == 128 + SIGKILL) | ||
4839 | *status += win_status - 128; | ||
4838 | pid = pidlist[idx]; | 4840 | pid = pidlist[idx]; |
4839 | } | 4841 | } |
4840 | done: | 4842 | done: |