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.c6
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 */