diff --git a/shell/lash.c b/shell/lash.c index fa416c742..f454e6990 100644 --- a/shell/lash.c +++ b/shell/lash.c @@ -656,6 +656,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[]) if (openfd != redir->fd) { if (squirrel && redir->fd < 3) { squirrel[redir->fd] = dup(redir->fd); + fcntl (squirrel[redir->fd], F_SETFD, FD_CLOEXEC); } dup2(openfd, redir->fd); close(openfd);