aboutsummaryrefslogtreecommitdiff
path: root/shell/ash.c
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2020-12-13 16:36:28 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2020-12-13 16:36:28 +0100
commit31df5a3eee74862312bbf89449d223aeae13aaf7 (patch)
tree199b8a43006378db47ea8412c5207b5e03986473 /shell/ash.c
parent6c5f4296dca1d836695d3ec77e7429bd40ca5ce3 (diff)
downloadbusybox-31df5a3eee74862312bbf89449d223aeae13aaf7.tar.gz
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>
Diffstat (limited to 'shell/ash.c')
-rw-r--r--shell/ash.c19
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)
shellparam.nparam++;
xargv++;
}
+
+ /* Interactive bash re-enables SIGHUP which is SIG_IGNed on entry.
+ * Try:
+ * trap '' hup; bash; echo RET # type "kill -hup $$", see SIGHUP having effect
+ * trap '' hup; bash -c 'kill -hup $$; echo ALIVE' # here SIGHUP is SIG_IGNed
+ * NB: must do it before setting up signals (in optschanged())
+ * and reading .profile etc (after we return from here):
+ */
+ if (iflag)
+ signal(SIGHUP, SIG_DFL);
+
optschanged();
return login_sh;
@@ -14510,14 +14521,6 @@ int ash_main(int argc UNUSED_PARAM, char **argv)
}
#endif
state4: /* XXX ??? - why isn't this before the "if" statement */
-
- /* Interactive bash re-enables SIGHUP which is SIG_IGNed on entry.
- * Try:
- * trap '' hup; bash; echo RET # type "kill -hup $$", see SIGHUP having effect
- * trap '' hup; bash -c 'kill -hup $$; echo ALIVE' # here SIGHUP is SIG_IGNed
- */
- signal(SIGHUP, SIG_DFL);
-
cmdloop(1);
}
#if PROFILE