diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-13 16:36:28 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2020-12-13 16:36:28 +0100 |
commit | 31df5a3eee74862312bbf89449d223aeae13aaf7 (patch) | |
tree | 199b8a43006378db47ea8412c5207b5e03986473 | |
parent | 6c5f4296dca1d836695d3ec77e7429bd40ca5ce3 (diff) | |
download | busybox-w32-31df5a3eee74862312bbf89449d223aeae13aaf7.tar.gz busybox-w32-31df5a3eee74862312bbf89449d223aeae13aaf7.tar.bz2 busybox-w32-31df5a3eee74862312bbf89449d223aeae13aaf7.zip |
ash: reset SIGHUP earlier: allows HUP traps in .profile, closes 13371
function old new delta
ash_main 1188 1203 +15
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | shell/ash.c | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/shell/ash.c b/shell/ash.c index 40695dee0..b271dd031 100644 --- a/shell/ash.c +++ b/shell/ash.c | |||
@@ -14340,6 +14340,17 @@ procargs(char **argv) | |||
14340 | shellparam.nparam++; | 14340 | shellparam.nparam++; |
14341 | xargv++; | 14341 | xargv++; |
14342 | } | 14342 | } |
14343 | |||
14344 | /* Interactive bash re-enables SIGHUP which is SIG_IGNed on entry. | ||
14345 | * Try: | ||
14346 | * trap '' hup; bash; echo RET # type "kill -hup $$", see SIGHUP having effect | ||
14347 | * trap '' hup; bash -c 'kill -hup $$; echo ALIVE' # here SIGHUP is SIG_IGNed | ||
14348 | * NB: must do it before setting up signals (in optschanged()) | ||
14349 | * and reading .profile etc (after we return from here): | ||
14350 | */ | ||
14351 | if (iflag) | ||
14352 | signal(SIGHUP, SIG_DFL); | ||
14353 | |||
14343 | optschanged(); | 14354 | optschanged(); |
14344 | 14355 | ||
14345 | return login_sh; | 14356 | return login_sh; |
@@ -14510,14 +14521,6 @@ int ash_main(int argc UNUSED_PARAM, char **argv) | |||
14510 | } | 14521 | } |
14511 | #endif | 14522 | #endif |
14512 | state4: /* XXX ??? - why isn't this before the "if" statement */ | 14523 | state4: /* XXX ??? - why isn't this before the "if" statement */ |
14513 | |||
14514 | /* Interactive bash re-enables SIGHUP which is SIG_IGNed on entry. | ||
14515 | * Try: | ||
14516 | * trap '' hup; bash; echo RET # type "kill -hup $$", see SIGHUP having effect | ||
14517 | * trap '' hup; bash -c 'kill -hup $$; echo ALIVE' # here SIGHUP is SIG_IGNed | ||
14518 | */ | ||
14519 | signal(SIGHUP, SIG_DFL); | ||
14520 | |||
14521 | cmdloop(1); | 14524 | cmdloop(1); |
14522 | } | 14525 | } |
14523 | #if PROFILE | 14526 | #if PROFILE |