From b370ddfb6b7ff2928745dac8d887d87a7713e993 Mon Sep 17 00:00:00 2001 From: JozanLeClerc Date: Mon, 11 May 2020 17:14:36 +0200 Subject: Can't pipe(2) --- src/ft_e_externs_pipes.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src') 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); } -- cgit v1.2.3