diff options
author | cracauer <cracauer@FreeBSD.org> | 1998-09-10 22:09:11 +0000 |
---|---|---|
committer | cracauer <cracauer@FreeBSD.org> | 1998-09-10 22:09:11 +0000 |
commit | 62616a44cfb0ebcda627090e0f957e34c66ad16b (patch) | |
tree | c3839c37196d905c6e8d9337ec9e88e820fd530e | |
parent | e573989d4559a29b4189808bf98c7df867eaccf2 (diff) | |
download | FreeBSD-src-62616a44cfb0ebcda627090e0f957e34c66ad16b.zip FreeBSD-src-62616a44cfb0ebcda627090e0f957e34c66ad16b.tar.gz |
Narrow down conditions to break wait() to process traps.
Improve comments.
-rw-r--r-- | bin/sh/jobs.h | 4 | ||||
-rw-r--r-- | bin/sh/trap.c | 7 |
2 files changed, 6 insertions, 5 deletions
diff --git a/bin/sh/jobs.h b/bin/sh/jobs.h index 7b1d431..e637eae 100644 --- a/bin/sh/jobs.h +++ b/bin/sh/jobs.h @@ -34,7 +34,7 @@ * SUCH DAMAGE. * * @(#)jobs.h 8.2 (Berkeley) 5/4/95 - * $Id: jobs.h,v 1.8 1998/08/25 09:33:34 cracauer Exp $ + * $Id: jobs.h,v 1.9 1998/09/08 13:16:52 cracauer Exp $ */ /* Mode argument to forkshell. Don't change FORK_FG or FORK_BG. */ @@ -80,7 +80,7 @@ extern pid_t backgndpid; /* pid of last background process */ extern int job_warning; /* user was warned about stopped jobs */ extern int in_waitcmd; /* are we in waitcmd()? */ extern int in_dowait; /* are we in dowait()? */ -extern volatile sig_atomic_t breakwaitcmd; /* should wait be terminated? */ +extern volatile sig_atomic_t breakwaitcmd; /* break wait to process traps? */ void setjobctl __P((int)); int fgcmd __P((int, char **)); diff --git a/bin/sh/trap.c b/bin/sh/trap.c index 666284c..fd359fc 100644 --- a/bin/sh/trap.c +++ b/bin/sh/trap.c @@ -39,7 +39,7 @@ static char sccsid[] = "@(#)trap.c 8.5 (Berkeley) 6/5/95"; #endif static const char rcsid[] = - "$Id: trap.c,v 1.15 1998/09/08 13:16:52 cracauer Exp $"; + "$Id: trap.c,v 1.16 1998/09/10 14:51:06 cracauer Exp $"; #endif /* not lint */ #include <signal.h> @@ -364,10 +364,11 @@ onsig(signo) if ((signo == SIGINT || signo == SIGQUIT) && in_waitcmd != 0) breakwaitcmd = 1; /* - * If a trap is set, we need to make sure it is executed even - * when a childs blocks all signals. + * 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 (trap[signo] != NULL && + ! trap[signo][0] == '\0' && ! (trap[signo][0] == ':' && trap[signo][1] == '\0')) breakwaitcmd = 1; } |