Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/make It should not be an error to have VAR != comman...



details:   https://anonhg.NetBSD.org/src/rev/70f6db276eba
branches:  trunk
changeset: 331698:70f6db276eba
user:      apb <apb%NetBSD.org@localhost>
date:      Wed Aug 20 08:37:25 2014 +0000

description:
It should not be an error to have VAR != command that prints no output

diffstat:

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

diffs (59 lines):

diff -r 7d5abe9033d7 -r 70f6db276eba usr.bin/make/main.c
--- a/usr.bin/make/main.c       Wed Aug 20 08:00:39 2014 +0000
+++ b/usr.bin/make/main.c       Wed Aug 20 08:37:25 2014 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main.c,v 1.227 2014/08/08 19:20:39 gson Exp $  */
+/*     $NetBSD: main.c,v 1.228 2014/08/20 08:37:25 apb Exp $   */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,7 +69,7 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: main.c,v 1.227 2014/08/08 19:20:39 gson Exp $";
+static char rcsid[] = "$NetBSD: main.c,v 1.228 2014/08/20 08:37:25 apb 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.227 2014/08/08 19:20:39 gson Exp $");
+__RCSID("$NetBSD: main.c,v 1.228 2014/08/20 08:37:25 apb 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