summaryrefslogtreecommitdiffstats
path: root/stream.c
diff options
context:
space:
mode:
Diffstat (limited to 'stream.c')
-rw-r--r--stream.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/stream.c b/stream.c
index 7d073fc1..dbe3e9ff 100644
--- a/stream.c
+++ b/stream.c
@@ -2158,9 +2158,13 @@ val open_process(val name, val mode_str, val args)
if (pid == 0) {
if (input) {
dup2(fd[1], STDOUT_FILENO);
+ if (fd[1] != STDOUT_FILENO) /* You never know */
+ close(fd[1]);
close(fd[0]);
} else {
dup2(fd[0], STDIN_FILENO);
+ if (fd[0] != STDIN_FILENO) /* You never know */
+ close(fd[0]);
close(fd[1]);
}