aboutsummaryrefslogtreecommitdiff
path: root/hush.c
diff options
context:
space:
mode:
Diffstat (limited to 'hush.c')
-rw-r--r--hush.c3
1 files changed, 2 insertions, 1 deletions
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);
}
}
}