summary refs log tree commit diff
path: root/support
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2018-12-01 21:43:36 +0100
committerFlorian Weimer <fweimer@redhat.com>2018-12-01 22:41:46 +0100
commit02cd5c1a8d033d7f91fea12a66bb44d1bbf85f76 (patch)
treeb30f94dace1c095ee797205034da5af99e7fd0cf /support
parentfc493bc9e6fe8ecdd00f79b9a8a3d4675137a602 (diff)
downloadglibc-02cd5c1a8d033d7f91fea12a66bb44d1bbf85f76.tar.gz
glibc-02cd5c1a8d033d7f91fea12a66bb44d1bbf85f76.tar.xz
glibc-02cd5c1a8d033d7f91fea12a66bb44d1bbf85f76.zip
support: Close original descriptors in support_capture_subprocess
Diffstat (limited to 'support')
-rw-r--r--support/support_capture_subprocess.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
index 6d2029e13b..93f6ea3102 100644
--- a/support/support_capture_subprocess.c
+++ b/support/support_capture_subprocess.c
@@ -59,8 +59,12 @@ support_capture_subprocess (void (*callback) (void *), void *closure)
 
   int stdout_pipe[2];
   xpipe (stdout_pipe);
+  TEST_VERIFY (stdout_pipe[0] > STDERR_FILENO);
+  TEST_VERIFY (stdout_pipe[1] > STDERR_FILENO);
   int stderr_pipe[2];
   xpipe (stderr_pipe);
+  TEST_VERIFY (stderr_pipe[0] > STDERR_FILENO);
+  TEST_VERIFY (stderr_pipe[1] > STDERR_FILENO);
 
   TEST_VERIFY (fflush (stdout) == 0);
   TEST_VERIFY (fflush (stderr) == 0);
@@ -72,6 +76,8 @@ support_capture_subprocess (void (*callback) (void *), void *closure)
       xclose (stderr_pipe[0]);
       xdup2 (stdout_pipe[1], STDOUT_FILENO);
       xdup2 (stderr_pipe[1], STDERR_FILENO);
+      xclose (stdout_pipe[1]);
+      xclose (stderr_pipe[1]);
       callback (closure);
       _exit (0);
     }