Module Name: src Committed By: apb Date: Wed Aug 20 08:37:25 UTC 2014
Modified Files: src/usr.bin/make: main.c Log Message: It should not be an error to have VAR != command that prints no output To generate a diff of this commit: cvs rdiff -u -r1.227 -r1.228 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.227 src/usr.bin/make/main.c:1.228 --- src/usr.bin/make/main.c:1.227 Fri Aug 8 19:20:39 2014 +++ src/usr.bin/make/main.c Wed Aug 20 08:37:25 2014 @@ -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 @@ __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.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 @@ 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))