Sat Jan 26 15:53:00 2013 UTC ()
Check read and write errors to avoid warnings from linux.
XXX: Should we print an error and exit instead?


(christos)
diff -r1.164 -r1.165 src/usr.bin/make/job.c
diff -r1.204 -r1.205 src/usr.bin/make/main.c

cvs diff -r1.164 -r1.165 src/usr.bin/make/job.c (expand / switch to context diff)
--- src/usr.bin/make/job.c 2013/01/25 02:01:10 1.164
+++ src/usr.bin/make/job.c 2013/01/26 15:52:59 1.165
@@ -1,4 +1,4 @@
-/*	$NetBSD: job.c,v 1.164 2013/01/25 02:01:10 sjg Exp $	*/
+/*	$NetBSD: job.c,v 1.165 2013/01/26 15:52:59 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.164 2013/01/25 02:01:10 sjg Exp $";
+static char rcsid[] = "$NetBSD: job.c,v 1.165 2013/01/26 15:52:59 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.164 2013/01/25 02:01:10 sjg Exp $");
+__RCSID("$NetBSD: job.c,v 1.165 2013/01/26 15:52:59 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -477,7 +477,8 @@
 static void
 JobChildSig(int signo MAKE_ATTR_UNUSED)
 {
-    write(childExitJob.outPipe, CHILD_EXIT, 1);
+    while (write(childExitJob.outPipe, CHILD_EXIT, 1) == -1 && errno == EAGAIN)
+	continue;
 }
 
 
@@ -504,7 +505,9 @@
      * Defer sending to SIGCONT to our stopped children until we return
      * from the signal handler.
      */
-    write(childExitJob.outPipe, DO_JOB_RESUME, 1);
+    while (write(childExitJob.outPipe, DO_JOB_RESUME, 1) == -1 &&
+	errno == EAGAIN)
+	continue;
 }
 
 /*-
@@ -1161,7 +1164,8 @@
 		 */
 		if (read(streamID, &c, 1) == 1) {
 		    (void)lseek(streamID, (off_t)0, SEEK_SET);
-		    (void)write(streamID, &c, 1);
+		    while (write(streamID, &c, 1) == -1 && errno == EAGAIN)
+			continue;
 		}
 
 		(void)close(streamID);
@@ -2046,7 +2050,8 @@
     if (nready < 0 || readyfd(&childExitJob)) {
 	char token = 0;
 	nready -= 1;
-	(void)read(childExitJob.inPipe, &token, 1);
+	while (read(childExitJob.inPipe, &token, 1) == -1 && errno == EAGAIN)
+		continue;
 	if (token == DO_JOB_RESUME[0])
 	    /* Complete relay requested from our SIGCONT handler */
 	    JobRestartJobs();
@@ -2777,7 +2782,8 @@
     if (DEBUG(JOB))
 	fprintf(debug_file, "(%d) aborting %d, deposit token %c\n",
 	    getpid(), aborting, JOB_TOKENS[aborting]);
-    write(tokenWaitJob.outPipe, &tok, 1);
+    while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN)
+	continue;
 }
 
 /*-
@@ -2890,13 +2896,15 @@
 	while (read(tokenWaitJob.inPipe, &tok1, 1) == 1)
 	    continue;
 	/* And put the stopper back */
-	write(tokenWaitJob.outPipe, &tok, 1);
+	while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN)
+	    continue;
 	Fatal("A failure has been detected in another branch of the parallel make");
     }
 
     if (count == 1 && jobTokensRunning == 0)
 	/* We didn't want the token really */
-	write(tokenWaitJob.outPipe, &tok, 1);
+	while (write(tokenWaitJob.outPipe, &tok, 1) == -1 && errno == EAGAIN)
+	    continue;
 
     jobTokensRunning++;
     if (DEBUG(JOB))

cvs diff -r1.204 -r1.205 src/usr.bin/make/main.c (expand / switch to context diff)
--- src/usr.bin/make/main.c 2013/01/25 02:01:10 1.204
+++ src/usr.bin/make/main.c 2013/01/26 15:53:00 1.205
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $	*/
+/*	$NetBSD: main.c,v 1.205 2013/01/26 15:53:00 christos Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.205 2013/01/26 15:53:00 christos Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.204 2013/01/25 02:01:10 sjg Exp $");
+__RCSID("$NetBSD: main.c,v 1.205 2013/01/26 15:53:00 christos Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1708,7 +1708,8 @@
 	IOADD(")\n");
 
 #ifdef USE_IOVEC
-	(void)writev(2, iov, 8);
+	while (writev(2, iov, 8) == -1 && errno == EAGAIN)
+	    continue;
 #endif
 }