summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-05-11 17:14:36 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-05-11 17:14:36 +0200
commitb370ddfb6b7ff2928745dac8d887d87a7713e993 (patch)
tree3d8aa947e4c9b7d227962f84dc78dc54840d8c72 /src
parentIt's not pipin' (diff)
download42-minishell-b370ddfb6b7ff2928745dac8d887d87a7713e993.tar.gz
42-minishell-b370ddfb6b7ff2928745dac8d887d87a7713e993.tar.bz2
42-minishell-b370ddfb6b7ff2928745dac8d887d87a7713e993.tar.xz
42-minishell-b370ddfb6b7ff2928745dac8d887d87a7713e993.tar.zst
42-minishell-b370ddfb6b7ff2928745dac8d887d87a7713e993.zip
Can't pipe(2)
Diffstat (limited to 'src')
-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);
}