]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
(_IO_old_proc_open): Apply change from 1999-03-29 to iopopen also here.
authorUlrich Drepper <drepper@redhat.com>
Tue, 22 Jun 1999 10:08:44 +0000 (10:08 +0000)
committerUlrich Drepper <drepper@redhat.com>
Tue, 22 Jun 1999 10:08:44 +0000 (10:08 +0000)
libio/oldiopopen.c

index c4116baae37505373393aa13b7e693a90d89e027..556a9ff86f4cb15992040a114ff6119991219698 100644 (file)
@@ -140,6 +140,8 @@ _IO_old_proc_open (fp, command, mode)
   if (child_pid == 0)
     {
       int child_std_end = mode[0] == 'r' ? 1 : 0;
+      struct _IO_proc_file *p;
+      
       _IO_close (parent_end);
       if (child_end != child_std_end)
        {
@@ -149,11 +151,8 @@ _IO_old_proc_open (fp, command, mode)
       /* POSIX.2:  "popen() shall ensure that any streams from previous
          popen() calls that remain open in the parent process are closed
         in the new child process." */
-      while (old_proc_file_chain)
-       {
-         _IO_close (_IO_fileno ((_IO_FILE *) old_proc_file_chain));
-         old_proc_file_chain = old_proc_file_chain->next;
-       }
+      for (p = old_proc_file_chain; p; p = p->next)
+       _IO_close (_IO_fileno ((_IO_FILE *) p));
 
       _IO_execl ("/bin/sh", "sh", "-c", command, (char *) 0);
       _IO__exit (127);