summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/ft_e_externs_pipes.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/ft_e_externs_pipes.c b/src/ft_e_externs_pipes.c
index 773905d..e5368f2 100644
--- a/src/ft_e_externs_pipes.c
+++ b/src/ft_e_externs_pipes.c
@@ -61,12 +61,13 @@ static void
dup2(pipefd[0], STDIN_FILENO);
ft_e_extern_child(fullpath[1], ptr->next->one, msh);
}
- else
+ else if (pid[1] < 0)
{
- close(pipefd[0]);
- close(pipefd[1]);
- waitpid(pid[1], &status, 0);
+ /* TODO: handle fork failed */
}
+ close(pipefd[0]);
+ close(pipefd[1]);
+ waitpid(pid[1], &status, 0);
waitpid(pid[0], &status, 0);
msh->ret = WEXITSTATUS(status);
}