diff options
-rw-r--r-- | hush.c | 3 | ||||
-rw-r--r-- | shell/hush.c | 3 |
2 files changed, 4 insertions, 2 deletions
@@ -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); } } } diff --git a/shell/hush.c b/shell/hush.c index 372c957..a58da18 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); } } } |