diff options
author | Andreas Schwab <schwab@suse.de> | 1999-03-29 16:01:58 +0000 |
---|---|---|
committer | Andreas Schwab <schwab@suse.de> | 1999-03-29 16:01:58 +0000 |
commit | 3c4936302a78646668ddc2a4d510f5f8cfa3c65e (patch) | |
tree | 227005359fae4d85e306e4d856f3fb57ba442439 /libio/iopopen.c | |
parent | ae6b87303186d9c11aaaf87b7a9500262c0f8c5a (diff) | |
download | glibc-3c4936302a78646668ddc2a4d510f5f8cfa3c65e.zip glibc-3c4936302a78646668ddc2a4d510f5f8cfa3c65e.tar.gz glibc-3c4936302a78646668ddc2a4d510f5f8cfa3c65e.tar.bz2 |
1999-03-29 Paul Eggert <eggert@twinsun.com>
* libio/iopopen.c (_IO_new_proc_open): Don't modify proc_file_chain
while in child process.
Diffstat (limited to 'libio/iopopen.c')
-rw-r--r-- | libio/iopopen.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/libio/iopopen.c b/libio/iopopen.c index 31f9e02..3f3868d 100644 --- a/libio/iopopen.c +++ b/libio/iopopen.c @@ -139,6 +139,8 @@ _IO_new_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) { @@ -148,11 +150,8 @@ _IO_new_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 (proc_file_chain) - { - _IO_close (_IO_fileno ((_IO_FILE *) proc_file_chain)); - proc_file_chain = proc_file_chain->next; - } + for (p = 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); |