Don't close file descriptors when we are duplicating them.
This commit is contained in:
parent
f4dd6e3d1a
commit
c616e53ca2
1
hush.c
1
hush.c
@ -1018,6 +1018,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
|
|||||||
close(openfd);
|
close(openfd);
|
||||||
} else {
|
} else {
|
||||||
dup2(openfd, redir->fd);
|
dup2(openfd, redir->fd);
|
||||||
|
if (redir->dup == -1)
|
||||||
close (openfd);
|
close (openfd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1018,6 +1018,7 @@ static int setup_redirects(struct child_prog *prog, int squirrel[])
|
|||||||
close(openfd);
|
close(openfd);
|
||||||
} else {
|
} else {
|
||||||
dup2(openfd, redir->fd);
|
dup2(openfd, redir->fd);
|
||||||
|
if (redir->dup == -1)
|
||||||
close (openfd);
|
close (openfd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user