diff options
| -rw-r--r-- | shell/hush.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/shell/hush.c b/shell/hush.c index 89a13feb8..bb95d6318 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -1456,13 +1456,15 @@ static void record_pending_signo(int sig) | |||
| 1456 | static void sigexit(int sig) NORETURN; | 1456 | static void sigexit(int sig) NORETURN; |
| 1457 | static void sigexit(int sig) | 1457 | static void sigexit(int sig) |
| 1458 | { | 1458 | { |
| 1459 | /* Disable all signals: job control, SIGPIPE, etc. */ | ||
| 1460 | sigprocmask_allsigs(SIG_BLOCK); | ||
| 1461 | |||
| 1462 | /* Careful: we can end up here after [v]fork. Do not restore | 1459 | /* Careful: we can end up here after [v]fork. Do not restore |
| 1463 | * tty pgrp then, only top-level shell process does that */ | 1460 | * tty pgrp then, only top-level shell process does that */ |
| 1464 | if (G_saved_tty_pgrp && getpid() == G.root_pid) | 1461 | if (G_saved_tty_pgrp && getpid() == G.root_pid) { |
| 1462 | /* Disable all signals: job control, SIGPIPE, etc. | ||
| 1463 | * Mostly paranoid measure, to prevent infinite SIGTTOU. | ||
| 1464 | */ | ||
| 1465 | sigprocmask_allsigs(SIG_BLOCK); | ||
| 1465 | tcsetpgrp(G_interactive_fd, G_saved_tty_pgrp); | 1466 | tcsetpgrp(G_interactive_fd, G_saved_tty_pgrp); |
| 1467 | } | ||
| 1466 | 1468 | ||
| 1467 | /* Not a signal, just exit */ | 1469 | /* Not a signal, just exit */ |
| 1468 | if (sig <= 0) | 1470 | if (sig <= 0) |
