Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make Restore apb's 20140820 commit (-r1.228 of main.c):



details:   https://anonhg.NetBSD.org/src/rev/512ad6c15596
branches:  trunk
changeset: 332149:512ad6c15596
user:      dholland <dholland%NetBSD.org@localhost>
date:      Tue Sep 09 06:18:17 2014 +0000

description:
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.

diffstat:

 usr.bin/make/main.c |  14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)

diffs (59 lines):

diff -r 124d5dab6757 -r 512ad6c15596 usr.bin/make/main.c
--- a/usr.bin/make/main.c       Tue Sep 09 02:43:19 2014 +0000
+++ b/usr.bin/make/main.c       Tue Sep 09 06:18:17 2014 +0000
@@ -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 @@
 #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 @@
     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 @@
                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 @@
        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))



Home | Main Index | Thread Index | Old Index