Module Name:    src
Committed By:   dholland
Date:           Tue Sep  9 06:18:17 UTC 2014

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

Log Message:
Restore apb's 20140820 commit (-r1.228 of main.c):
It should not be an error to have VAR != command that prints no output

Joerg reverted a bit too enthusiastically.


To generate a diff of this commit:
cvs rdiff -u -r1.230 -r1.231 src/usr.bin/make/main.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/main.c
diff -u src/usr.bin/make/main.c:1.230 src/usr.bin/make/main.c:1.231
--- src/usr.bin/make/main.c:1.230	Sun Sep  7 20:55:34 2014
+++ src/usr.bin/make/main.c	Tue Sep  9 06:18:17 2014
@@ -1,4 +1,4 @@
-/*	$NetBSD: main.c,v 1.230 2014/09/07 20:55:34 joerg Exp $	*/
+/*	$NetBSD: main.c,v 1.231 2014/09/09 06:18:17 dholland Exp $	*/
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.230 2014/09/07 20:55:34 joerg Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.231 2014/09/09 06:18:17 dholland Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
@@ -81,7 +81,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 19
 #if 0
 static char sccsid[] = "@(#)main.c	8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: main.c,v 1.230 2014/09/07 20:55:34 joerg Exp $");
+__RCSID("$NetBSD: main.c,v 1.231 2014/09/09 06:18:17 dholland Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1488,10 +1488,12 @@ Cmd_Exec(const char *cmd, const char **e
     int		status;		/* command exit status */
     Buffer	buf;		/* buffer to store the result */
     char	*cp;
-    int		cc;
+    int		cc;		/* bytes read, or -1 */
+    int		savederr;	/* saved errno */
 
 
     *errnum = NULL;
+    savederr = 0;
 
     if (!shellName)
 	Shell_Init();
@@ -1554,6 +1556,8 @@ Cmd_Exec(const char *cmd, const char **e
 		Buf_AddBytes(&buf, cc, result);
 	}
 	while (cc > 0 || (cc == -1 && errno == EINTR));
+	if (cc == -1)
+	    savederr = errno;
 
 	/*
 	 * Close the input side of the pipe.
@@ -1570,7 +1574,7 @@ Cmd_Exec(const char *cmd, const char **e
 	cc = Buf_Size(&buf);
 	res = Buf_Destroy(&buf, FALSE);
 
-	if (cc == 0)
+	if (savederr != 0)
 	    *errnum = "Couldn't read shell's output for \"%s\"";
 
 	if (WIFSIGNALED(status))

Reply via email to