summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorpk <pk@NetBSD.org>2002-03-18 12:28:07 +0000
committerpk <pk@NetBSD.org>2002-03-18 12:28:07 +0000
commitf41ec821b9e8b9cc2af0eddd0604d0ea7e89d08c (patch)
treed15036baa539330d008ee5385c6d98bf80f5c7ca /usr.bin/make
parent597ba8fdc121402491d5b51b42ebb91d8e9713b9 (diff)
Fix signal-handling bogons in JobPassSig():
- don't block the signal we're about to send to ourselves to take the default action for - restore the signal handler for the current signal - remove duplicate sigprocmask() call As a result, restoring the SIGTSTP handler in JobContinueSig() is no longer necessary.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/job.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 0bacfb7f46d..0467109e35e 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,4 +1,4 @@
-/* $NetBSD: job.c,v 1.67 2002/03/18 08:23:33 pk Exp $ */
+/* $NetBSD: job.c,v 1.68 2002/03/18 12:28:07 pk Exp $ */
/*
* Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -39,14 +39,14 @@
*/
#ifdef MAKE_BOOTSTRAP
-static char rcsid[] = "$NetBSD: job.c,v 1.67 2002/03/18 08:23:33 pk Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.68 2002/03/18 12:28:07 pk Exp $";
#else
#include <sys/cdefs.h>
#ifndef lint
#if 0
static char sccsid[] = "@(#)job.c 8.2 (Berkeley) 3/19/94";
#else
-__RCSID("$NetBSD: job.c,v 1.67 2002/03/18 08:23:33 pk Exp $");
+__RCSID("$NetBSD: job.c,v 1.68 2002/03/18 12:28:07 pk Exp $");
#endif
#endif /* not lint */
#endif
@@ -419,9 +419,6 @@ static void
JobContinueSig(signo)
int signo; /* The signal number we've received */
{
- if (signal(SIGTSTP, SIG_IGN) != SIG_IGN) {
- (void) signal(SIGTSTP, JobPassSig);
- }
JobRestartJobs();
}
#endif
@@ -482,11 +479,13 @@ JobPassSig(signo)
* we take any other signal.
*/
sigfillset(&nmask);
- sigprocmask(SIG_SETMASK, &nmask, &omask);
+ sigdelset(&nmask, signo);
+ (void) sigprocmask(SIG_SETMASK, &nmask, &omask);
+
act.sa_handler = SIG_DFL;
sigemptyset(&act.sa_mask);
act.sa_flags = 0;
- sigaction(signo, &act, NULL);
+ (void) sigaction(signo, &act, NULL);
if (DEBUG(JOB)) {
(void) fprintf(stdout,
@@ -500,12 +499,10 @@ JobPassSig(signo)
Lst_ForEach(jobs, JobCondPassSig, (ClientData) &sigcont);
}
+ /* Restore handler and signal mask */
+ act.sa_handler = JobPassSig;
+ (void) sigaction(signo, &act, NULL);
(void) sigprocmask(SIG_SETMASK, &omask, NULL);
- sigprocmask(SIG_SETMASK, &omask, NULL);
- if (signo != SIGCONT && signo != SIGTSTP) {
- act.sa_handler = JobPassSig;
- sigaction(sigcont, &act, NULL);
- }
}
/*-