Module Name:    src
Committed By:   christos
Date:           Sat Feb  2 15:11:49 UTC 2013

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

Log Message:
Don't wait forever for output from a child job.


To generate a diff of this commit:
cvs rdiff -u -r1.165 -r1.166 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.165 src/usr.bin/make/job.c:1.166
--- src/usr.bin/make/job.c:1.165	Sat Jan 26 10:52:59 2013
+++ src/usr.bin/make/job.c	Sat Feb  2 10:11:48 2013
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.165 2013/01/26 15:52:59 christos Exp $	*/
+/*	$NetBSD: job.c,v 1.166 2013/02/02 15:11:48 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: job.c,v 1.165 2013/01/26 15:52:59 christos Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.166 2013/02/02 15:11:48 christos 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.165 2013/01/26 15:52:59 christos Exp $");
+__RCSID("$NetBSD: job.c,v 1.166 2013/02/02 15:11:48 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -2050,7 +2050,8 @@ Job_CatchOutput(void)
     if (nready < 0 || readyfd(&childExitJob)) {
 	char token = 0;
 	nready -= 1;
-	while (read(childExitJob.inPipe, &token, 1) == -1 && errno == EAGAIN)
+	for (size_t i = 0; i < 5 &&
+	    read(childExitJob.inPipe, &token, 1) == -1 && errno == EAGAIN; i++)
 		continue;
 	if (token == DO_JOB_RESUME[0])
 	    /* Complete relay requested from our SIGCONT handler */

Reply via email to