summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2019-06-16 14:54:46 -0400
committerTavian Barnes <tavianator@tavianator.com>2019-06-16 15:00:17 -0400
commit78dfcf6237400281940a7bd97c05ac18eb69c577 (patch)
tree71e108e2fc948e6e7d1caa5ed4adaa10164f4bcf
parent3890d79b222709c940330209ff392944e6df860c (diff)
downloadbfs-78dfcf6237400281940a7bd97c05ac18eb69c577.tar.xz
spawn: Move the pipe FD out of the way of input FDs too
-rw-r--r--spawn.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/spawn.c b/spawn.c
index 96c8a1a..18ddd72 100644
--- a/spawn.c
+++ b/spawn.c
@@ -148,7 +148,7 @@ static void bfs_spawn_exec(const char *exe, const struct bfs_spawn *ctx, char **
for (const struct bfs_spawn_action *action = actions; action; action = action->next) {
// Move the error-reporting pipe out of the way if necessary
- if (action->out_fd == pipefd[1]) {
+ if (action->in_fd == pipefd[1] || action->out_fd == pipefd[1]) {
int fd = dup(pipefd[1]);
if (fd < 0) {
goto fail;