summaryrefslogtreecommitdiff
path: root/usr.bin/make
diff options
context:
space:
mode:
authorMarc Espie <espie@cvs.openbsd.org>2007-11-03 10:41:49 +0000
committerMarc Espie <espie@cvs.openbsd.org>2007-11-03 10:41:49 +0000
commit88e8357f78ed7acb8751294e2d802d7f41bb5fed (patch)
tree58776011e5ad9a22632f17183fe82b6fda4f1333 /usr.bin/make
parentda1b870f0988a0d77ee10618f587edbfcc9614a2 (diff)
fix an obnoxious bug: in parallel mode, dieing in the job controller is not
the same as dieing in a sub job, since waiting on sub-jobs won't work. So keep track of who we are via a state variable.
Diffstat (limited to 'usr.bin/make')
-rw-r--r--usr.bin/make/error.c11
-rw-r--r--usr.bin/make/error.h5
-rw-r--r--usr.bin/make/job.c5
3 files changed, 14 insertions, 7 deletions
diff --git a/usr.bin/make/error.c b/usr.bin/make/error.c
index 314b6d7a04e..eee710f1a18 100644
--- a/usr.bin/make/error.c
+++ b/usr.bin/make/error.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: error.c,v 1.14 2007/11/02 17:27:24 espie Exp $ */
+/* $OpenBSD: error.c,v 1.15 2007/11/03 10:41:48 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -41,7 +41,9 @@
#include "lowparse.h"
-int fatal_errors = 0;
+int fatal_errors = 0;
+bool supervise_jobs = false;
+
static void ParseVErrorInternal(const char *, unsigned long, int, const char *, va_list);
/*-
* Error --
@@ -73,9 +75,10 @@ Fatal(char *fmt, ...)
{
va_list ap;
- va_start(ap, fmt);
- Job_Wait();
+ if (supervise_jobs)
+ Job_Wait();
+ va_start(ap, fmt);
(void)vfprintf(stderr, fmt, ap);
va_end(ap);
(void)fprintf(stderr, "\n");
diff --git a/usr.bin/make/error.h b/usr.bin/make/error.h
index 7436b34c7b7..e501b52f9a9 100644
--- a/usr.bin/make/error.h
+++ b/usr.bin/make/error.h
@@ -1,7 +1,7 @@
#ifndef ERROR_H
#define ERROR_H
/* $OpenPackages$ */
-/* $OpenBSD: error.h,v 1.7 2001/09/19 10:58:07 mpech Exp $ */
+/* $OpenBSD: error.h,v 1.8 2007/11/03 10:41:48 espie Exp $ */
/*
* Copyright (c) 2001 Marc Espie.
@@ -57,4 +57,7 @@ extern void Finish(int);
#define PARSE_FATAL 1
extern void Parse_Error(int, const char *, ...);
extern int fatal_errors;
+/* Needed for fatal errors: we have to know whether we must abort other jobs
+ * or not */
+extern bool supervise_jobs;
#endif
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c
index 363f553a76e..d730c0d5605 100644
--- a/usr.bin/make/job.c
+++ b/usr.bin/make/job.c
@@ -1,5 +1,5 @@
/* $OpenPackages$ */
-/* $OpenBSD: job.c,v 1.103 2007/11/03 10:38:14 espie Exp $ */
+/* $OpenBSD: job.c,v 1.104 2007/11/03 10:41:48 espie Exp $ */
/* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */
/*
@@ -738,7 +738,7 @@ JobExec(Job *job)
if ((cpid = fork()) == -1) {
Punt("Cannot fork");
} else if (cpid == 0) {
-
+ supervise_jobs = false;
/* standard pipe code to route stdout and stderr */
close(fdout[0]);
if (dup2(fdout[1], 1) == -1)
@@ -777,6 +777,7 @@ JobExec(Job *job)
exit(1);
}
} else {
+ supervise_jobs = true;
job->pid = cpid;
/* we set the current position in the buffers to the beginning