about summary refs log tree commit diff
path: root/support/support_capture_subprocess.c
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2021-08-03 21:10:53 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2021-08-03 21:10:53 +0530
commit45caed9d67a00af917d8b5b88d4b5eb1225b7aef (patch)
treef760c079b88c59fc1a9872ce5755d7a04cf73696 /support/support_capture_subprocess.c
parent1e0e6d656db9dfa12ef7eb67976385d3deb0d4ff (diff)
downloadglibc-45caed9d67a00af917d8b5b88d4b5eb1225b7aef.tar.gz
glibc-45caed9d67a00af917d8b5b88d4b5eb1225b7aef.tar.xz
glibc-45caed9d67a00af917d8b5b88d4b5eb1225b7aef.zip
copy_and_spawn_sgid: Avoid double calls to close()
If close() on infd and outfd succeeded, reset the fd numbers so that
we don't attempt to close them again.

Reviewed-by: Arjun Shankar <arjun@redhat.com>
Diffstat (limited to 'support/support_capture_subprocess.c')
-rw-r--r--support/support_capture_subprocess.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/support/support_capture_subprocess.c b/support/support_capture_subprocess.c
index 27bfd19c93..0bacf6dbc2 100644
--- a/support/support_capture_subprocess.c
+++ b/support/support_capture_subprocess.c
@@ -170,6 +170,7 @@ copy_and_spawn_sgid (char *child_id, gid_t gid)
      support_subprogram because we only want the program exit status, not the
      contents.  */
   ret = 0;
+  infd = outfd = -1;
 
   char * const args[] = {execname, child_id, NULL};