Narrow down conditions to break wait() to process traps.

Improve comments.
This commit is contained in:
cracauer 1998-09-10 22:09:11 +00:00
parent 954474eb23
commit 0a716cdf2c
2 changed files with 6 additions and 5 deletions

View File

@ -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 **));

View File

@ -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;
}