summaryrefslogtreecommitdiff
path: root/lib/execute.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2009-07-19 12:45:28 +0200
committerBruno Haible <bruno@clisp.org>2009-07-19 12:45:28 +0200
commita1ccba770ff8235d893e3df1c4876b6f25aae0a2 (patch)
tree91b3845b8365b067baa7206df278b5a86e0addc9 /lib/execute.c
parent4efe06bb8c6fe077763395de650d1813eb66553d (diff)
downloadgnulib-a1ccba770ff8235d893e3df1c4876b6f25aae0a2.tar.gz
Fix handling of closed stdin/stdout/stderr on mingw.
Diffstat (limited to 'lib/execute.c')
-rw-r--r--lib/execute.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/execute.c b/lib/execute.c
index a6911d97b3..5127884c70 100644
--- a/lib/execute.c
+++ b/lib/execute.c
@@ -119,11 +119,11 @@ execute (const char *progname,
/* Save standard file handles of parent process. */
if (null_stdin)
- orig_stdin = dup_noinherit (STDIN_FILENO);
+ orig_stdin = dup_safer_noinherit (STDIN_FILENO);
if (null_stdout)
- orig_stdout = dup_noinherit (STDOUT_FILENO);
+ orig_stdout = dup_safer_noinherit (STDOUT_FILENO);
if (null_stderr)
- orig_stderr = dup_noinherit (STDERR_FILENO);
+ orig_stderr = dup_safer_noinherit (STDERR_FILENO);
exitcode = -1;
/* Create standard file handles of child process. */
@@ -173,11 +173,11 @@ execute (const char *progname,
/* Restore standard file handles of parent process. */
if (null_stderr)
- dup2 (orig_stderr, STDERR_FILENO), close (orig_stderr);
+ undup_safer_noinherit (orig_stderr, STDERR_FILENO);
if (null_stdout)
- dup2 (orig_stdout, STDOUT_FILENO), close (orig_stdout);
+ undup_safer_noinherit (orig_stdout, STDOUT_FILENO);
if (null_stdin)
- dup2 (orig_stdin, STDIN_FILENO), close (orig_stdin);
+ undup_safer_noinherit (orig_stdin, STDIN_FILENO);
if (termsigp != NULL)
*termsigp = 0;