diff options
Diffstat (limited to 'bin/sh/trap.c')
-rw-r--r-- | bin/sh/trap.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/bin/sh/trap.c b/bin/sh/trap.c index 1411289..3fc8566 100644 --- a/bin/sh/trap.c +++ b/bin/sh/trap.c @@ -74,6 +74,7 @@ __FBSDID("$FreeBSD$"); static char sigmode[NSIG]; /* current value of signal */ volatile sig_atomic_t pendingsig; /* indicates some signal received */ +volatile sig_atomic_t pendingsig_waitcmd; /* indicates SIGINT/SIGQUIT received */ int in_dotrap; /* do we execute in a trap handler? */ static char *volatile trap[NSIG]; /* trap handler commands */ static volatile sig_atomic_t gotsig[NSIG]; @@ -389,23 +390,13 @@ onsig(int signo) } /* If we are currently in a wait builtin, prepare to break it */ - if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) { - breakwaitcmd = 1; - pendingsig = signo; - } + if (signo == SIGINT || signo == SIGQUIT) + pendingsig_waitcmd = signo; if (trap[signo] != NULL && trap[signo][0] != '\0' && (signo != SIGCHLD || !ignore_sigchld)) { gotsig[signo] = 1; pendingsig = signo; - - /* - * If a trap is set, not ignored and not the null command, we - * need to make sure traps are executed even when a child - * blocks signals. - */ - if (Tflag && !(trap[signo][0] == ':' && trap[signo][1] == '\0')) - breakwaitcmd = 1; } #ifndef NO_HISTORY @@ -428,6 +419,7 @@ dotrap(void) in_dotrap++; for (;;) { pendingsig = 0; + pendingsig_waitcmd = 0; for (i = 1; i < NSIG; i++) { if (gotsig[i]) { gotsig[i] = 0; |