diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-27 14:34:47 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-07-27 14:34:47 +0000 |
commit | 6a62f0086f2b755378f66cfe3b1df0817b998b0d (patch) | |
tree | cefbb5d8effce1354c7e66c1ab132697f61f96b7 /lib/libc | |
parent | 7f82b0562044f0296e49881eff72852ecba14783 (diff) |
close all pipes in child; netbsd pr#2575
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/gen/popen.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c index ccc8bad7c0a..2be0e35bbe2 100644 --- a/lib/libc/gen/popen.c +++ b/lib/libc/gen/popen.c @@ -104,6 +104,12 @@ popen(program, type) } (void)close(pdes[1]); } + /* + * because vfork() instead of fork(), must leak FILE *, + * but luckily we are terminally headed for an execl() + */ + for (cur = pidlist; cur; cur = cur->next) + close(fileno(cur->fp)); execl(_PATH_BSHELL, "sh", "-c", program, NULL); _exit(127); /* NOTREACHED */ |