From: Matt Kraai Date: Tue, 5 Jun 2001 16:50:08 +0000 (-0000) Subject: Don't close file descriptors when we are duplicating them. X-Git-Tag: 0_52~114 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c616e53ca2d5a46ee5a2b7f272b1b611f01836eb;p=oweals%2Fbusybox.git Don't close file descriptors when we are duplicating them. --- diff --git a/hush.c b/hush.c index 372c95753..a58da189c 100644 --- a/hush.c +++ b/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); } } } 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); } } }