summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorDenys Vlasenko2011-05-12 10:59:18 +0200
committerDenys Vlasenko2011-05-12 10:59:18 +0200
commitebc1ee2e2a243a0ff3de6d2b70406ba75b771fa0 (patch)
tree5c13137248122946df4063235436a389c1d46029 /shell
parent0c40a731e3fcebe49f5b1636011b20cb316aeb0d (diff)
downloadbusybox-ebc1ee2e2a243a0ff3de6d2b70406ba75b771fa0.zip
busybox-ebc1ee2e2a243a0ff3de6d2b70406ba75b771fa0.tar.gz
hush: remove one sigprocmask from exit path
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 89a13fe..bb95d63 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1456,13 +1456,15 @@ static void record_pending_signo(int sig)
static void sigexit(int sig) NORETURN;
static void sigexit(int sig)
{
- /* Disable all signals: job control, SIGPIPE, etc. */
- sigprocmask_allsigs(SIG_BLOCK);
-
/* Careful: we can end up here after [v]fork. Do not restore
* tty pgrp then, only top-level shell process does that */
- if (G_saved_tty_pgrp && getpid() == G.root_pid)
+ if (G_saved_tty_pgrp && getpid() == G.root_pid) {
+ /* Disable all signals: job control, SIGPIPE, etc.
+ * Mostly paranoid measure, to prevent infinite SIGTTOU.
+ */
+ sigprocmask_allsigs(SIG_BLOCK);
tcsetpgrp(G_interactive_fd, G_saved_tty_pgrp);
+ }
/* Not a signal, just exit */
if (sig <= 0)