summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.bin/make/main.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/usr.bin/make/main.c b/usr.bin/make/main.c
index 9fccf969df2d..497eb779e3a0 100644
--- a/usr.bin/make/main.c
+++ b/usr.bin/make/main.c
@@ -410,6 +410,10 @@ chdir_verify_path(char *path, char *obpath)
return 0;
}
+void
+catch_child(int sig)
+{
+}
/*-
* main --
@@ -452,6 +456,22 @@ main(int argc, char **argv)
/* avoid faults on read-only strings */
static char syspath[] = _PATH_DEFSYSPATH;
+ {
+ /*
+ * Catch SIGCHLD so that we get kicked out of select() when we
+ * need to look at a child. This is only known to matter for the
+ * -j case (perhaps without -P).
+ *
+ * XXX this is intentionally misplaced.
+ */
+ struct sigaction sa;
+
+ sigemptyset(&sa.sa_mask);
+ sa.sa_flags = SA_RESTART | SA_NOCLDSTOP;
+ sa.sa_handler = catch_child;
+ sigaction(SIGCHLD, &sa, NULL);
+ }
+
#ifdef WANT_ENV_MKLVL
if ((iMkLvl = szMkLvl ? atoi(szMkLvl) : 0) < 0) {
iMkLvl = 0;