summaryrefslogtreecommitdiffstats
path: root/lib/libc/gen/popen.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/gen/popen.c')
-rw-r--r--lib/libc/gen/popen.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/libc/gen/popen.c b/lib/libc/gen/popen.c
index 8616671..bcbd164 100644
--- a/lib/libc/gen/popen.c
+++ b/lib/libc/gen/popen.c
@@ -65,6 +65,7 @@ popen(command, type)
FILE *iop;
int pdes[2], pid, twoway;
char *argv[4];
+ struct pid *p;
/*
* Lite2 introduced two-way popen() pipes using socketpair().
@@ -124,6 +125,9 @@ popen(command, type)
}
(void)close(pdes[1]);
}
+ for (p = pidlist; p; p = p->next) {
+ (void)close(fileno(p->fp));
+ }
execve(_PATH_BSHELL, argv, environ);
_exit(127);
/* NOTREACHED */
OpenPOWER on IntegriCloud