diff options
| author | Ron Yorston <rmy@pobox.com> | 2020-02-10 12:55:41 +0000 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2020-02-10 12:55:41 +0000 |
| commit | 2ed9b3d2e51ddcedcac75fbbe58f5c70d33c1bd8 (patch) | |
| tree | a63b3fff5a4a8c92c4a8e6d690e40636caed61c5 /shell | |
| parent | 5f2f75d721dcf7629facd7fd366f42fec80ada21 (diff) | |
| download | busybox-w32-2ed9b3d2e51ddcedcac75fbbe58f5c70d33c1bd8.tar.gz busybox-w32-2ed9b3d2e51ddcedcac75fbbe58f5c70d33c1bd8.tar.bz2 busybox-w32-2ed9b3d2e51ddcedcac75fbbe58f5c70d33c1bd8.zip | |
ash: fixes to trap
If a trap is set for SIGINT don't call raise(SIGINT) in preadfd(),
otherwise the shell exits because the signal isn't being caught.
In forkshell_init() change the initialisation of trap and trap_ptr.
Diffstat (limited to 'shell')
| -rw-r--r-- | shell/ash.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/shell/ash.c b/shell/ash.c index e032966bd..b3ec4caf8 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
| @@ -11266,7 +11266,9 @@ preadfd(void) | |||
| 11266 | if (trap[SIGINT]) { | 11266 | if (trap[SIGINT]) { |
| 11267 | buf[0] = '\n'; | 11267 | buf[0] = '\n'; |
| 11268 | buf[1] = '\0'; | 11268 | buf[1] = '\0'; |
| 11269 | # if !ENABLE_PLATFORM_MINGW32 | ||
| 11269 | raise(SIGINT); | 11270 | raise(SIGINT); |
| 11271 | # endif | ||
| 11270 | return 1; | 11272 | return 1; |
| 11271 | } | 11273 | } |
| 11272 | exitstatus = 128 + SIGINT; | 11274 | exitstatus = 128 + SIGINT; |
| @@ -16216,9 +16218,8 @@ forkshell_init(const char *idstr) | |||
| 16216 | } | 16218 | } |
| 16217 | } | 16219 | } |
| 16218 | fs->gmp->exception_handler = ash_ptr_to_globals_misc->exception_handler; | 16220 | fs->gmp->exception_handler = ash_ptr_to_globals_misc->exception_handler; |
| 16219 | for (i = 0; i < NSIG; i++) | 16221 | memset(fs->gmp->trap, 0, sizeof(fs->gmp->trap[0])*NSIG); |
| 16220 | fs->gmp->trap[i] = ash_ptr_to_globals_misc->trap[i]; | 16222 | fs->gmp->trap_ptr = fs->gmp->trap; |
| 16221 | fs->gmp->trap_ptr = ash_ptr_to_globals_misc->trap_ptr; | ||
| 16222 | 16223 | ||
| 16223 | /* Switch global variables */ | 16224 | /* Switch global variables */ |
| 16224 | gvpp = (struct globals_var **)&ash_ptr_to_globals_var; | 16225 | gvpp = (struct globals_var **)&ash_ptr_to_globals_var; |
