summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEli Zaretskii <eliz@gnu.org>2009-03-07 17:30:30 +0000
committerEli Zaretskii <eliz@gnu.org>2009-03-07 17:30:30 +0000
commit656b15a40423a90ca74e3f29ea206e9bae4da5e5 (patch)
treefe346107b036319b11979f64782606dcd244973a
parentf8f3b9005b47c821f35275c3fefd228f76a59301 (diff)
downloadgunmake-656b15a40423a90ca74e3f29ea206e9bae4da5e5.tar.gz
* function.c (func_shell): Don't close pipedes[1] if it is -1.
Fixes Savannah bug #20495.
-rw-r--r--ChangeLog5
-rw-r--r--function.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index d923a80..030a91f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-07 Eli Zaretskii <eliz@gnu.org>
+
+ * function.c (func_shell): Don't close pipedes[1] if it is -1.
+ Fixes Savannah bug #20495.
+
2008-09-30 Eli Zaretskii <eliz@gnu.org>
* build_w32.bat (GCCBuild): Use "-gdwarf-2 -g3" instead of
diff --git a/function.c b/function.c
index 09edbad..10d3d6b 100644
--- a/function.c
+++ b/function.c
@@ -1687,8 +1687,11 @@ func_shell (char *o, char **argv, const char *funcname UNUSED)
free (command_argv[0]);
free (command_argv);
- /* Close the write side of the pipe. */
- close (pipedes[1]);
+ /* Close the write side of the pipe. We test for -1, since
+ pipedes[1] is -1 on MS-Windows, and some versions of MS
+ libraries barf when `close' is called with -1. */
+ if (pipedes[1] >= 0)
+ close (pipedes[1]);
#endif
/* Set up and read from the pipe. */