]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
copy_and_spawn_sgid: Avoid double calls to close()
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 3 Aug 2021 15:40:53 +0000 (21:10 +0530)
committerSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 3 Aug 2021 15:40:53 +0000 (21:10 +0530)
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>
support/support_capture_subprocess.c

index 27bfd19c9374a18340abb7d5b87643a43356e137..0bacf6dbc23b0732445622bb8e07b41cfa9e53d7 100644 (file)
@@ -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};