aboutsummaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
Diffstat (limited to 'shell')
-rw-r--r--shell/hush.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/shell/hush.c b/shell/hush.c
index 372c95753..a58da189c 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1018,7 +1018,8 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
close(openfd);
} else {
dup2(openfd, redir->fd);
- close(openfd);
+ if (redir->dup == -1)
+ close (openfd);
}
}
}