Don't close file descriptors when we are duplicating them.

This commit is contained in:
Matt Kraai 2001-06-05 16:50:08 +00:00
parent f4dd6e3d1a
commit c616e53ca2
2 changed files with 4 additions and 2 deletions

3
hush.c
View File

@ -1018,7 +1018,8 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
close(openfd); close(openfd);
} else { } else {
dup2(openfd, redir->fd); dup2(openfd, redir->fd);
close(openfd); if (redir->dup == -1)
close (openfd);
} }
} }
} }

View File

@ -1018,7 +1018,8 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
close(openfd); close(openfd);
} else { } else {
dup2(openfd, redir->fd); dup2(openfd, redir->fd);
close(openfd); if (redir->dup == -1)
close (openfd);
} }
} }
} }