Module Name:    src
Committed By:   rillig
Date:           Fri Mar  7 16:41:21 UTC 2025

Modified Files:
        src/usr.bin/make: job.c

Log Message:
make: prevent SIGPIPE for child processes in parallel mode

Starting with job.c 1.198 from 2020-06-19, when one branch of a parallel
build failed, make exited immediately without waiting until the child
processes from the other branches had finished. As a consequence, the
child processes faced a SIGPIPE when they tried to write to stdout.

The call to Job_Wait is taken straight from Fatal, where it used to be
called before the "die silently" execution path was introduced in 2020.


To generate a diff of this commit:
cvs rdiff -u -r1.487 -r1.488 src/usr.bin/make/job.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/make/job.c
diff -u src/usr.bin/make/job.c:1.487 src/usr.bin/make/job.c:1.488
--- src/usr.bin/make/job.c:1.487	Fri Mar  7 06:50:34 2025
+++ src/usr.bin/make/job.c	Fri Mar  7 16:41:21 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.487 2025/03/07 06:50:34 rillig Exp $	*/
+/*	$NetBSD: job.c,v 1.488 2025/03/07 16:41:21 rillig Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -138,7 +138,7 @@
 #include "trace.h"
 
 /*	"@(#)job.c	8.2 (Berkeley) 3/19/94"	*/
-MAKE_RCSID("$NetBSD: job.c,v 1.487 2025/03/07 06:50:34 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.488 2025/03/07 16:41:21 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -2747,10 +2747,7 @@ Job_TokenWithdraw(void)
 		       errno == EAGAIN)
 			continue;
 		if (shouldDieQuietly(NULL, 1)) {
-			/*
-			 * TODO: better clean up properly, to avoid killing
-			 *  child processes by SIGPIPE.
-			 */
+			Job_Wait();
 			exit(6);
 		}
 		Fatal("A failure has been detected "

Reply via email to