diff options
author | Ron Yorston <rmy@pobox.com> | 2023-09-13 10:05:56 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2023-09-13 10:05:56 +0100 |
commit | e3d50157ce21f990c33afdcf8dba8080308ce0f0 (patch) | |
tree | 1ab24bc6a5ab957c3db4882631caa947c0dfd198 | |
parent | 504f373c8d4447a4801a74887f99f0dfa809f53e (diff) | |
download | busybox-w32-e3d50157ce21f990c33afdcf8dba8080308ce0f0.tar.gz busybox-w32-e3d50157ce21f990c33afdcf8dba8080308ce0f0.tar.bz2 busybox-w32-e3d50157ce21f990c33afdcf8dba8080308ce0f0.zip |
ash: fix signal handling
Commit 89aa9d783 (win32: changes to signal handling) caused a
regression: 'httpd -f' could no longer be interrupted by Ctrl-C.
The specific issue is the use of exit(2) to replace raise(3) in
raise_interrupt(). This change was made so the shell would return
the expected exit code of 130 rather than the default code of 3
which Windows uses when a signal with SIG_DFL disposition is caught.
The problem can be avoided by calling _exit(2) instead. A call to
fflush_all() has also been added, as _exit(2) doesn't do that.
(GitHub issue #365)
-rw-r--r-- | shell/ash.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/shell/ash.c b/shell/ash.c index a19a3c686..dcc73031f 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -955,7 +955,8 @@ raise_interrupt(void) | |||
955 | signal(SIGINT, SIG_DFL); | 955 | signal(SIGINT, SIG_DFL); |
956 | raise(SIGINT); | 956 | raise(SIGINT); |
957 | #else | 957 | #else |
958 | exit(SIGINT << 24); | 958 | fflush_all(); |
959 | _exit(SIGINT << 24); | ||
959 | #endif | 960 | #endif |
960 | } | 961 | } |
961 | #if ENABLE_PLATFORM_MINGW32 | 962 | #if ENABLE_PLATFORM_MINGW32 |