summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ft_e_externs_pipes.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/ft_e_externs_pipes.c b/src/ft_e_externs_pipes.c
index a54e565..773905d 100644
--- a/src/ft_e_externs_pipes.c
+++ b/src/ft_e_externs_pipes.c
@@ -38,24 +38,24 @@ static void
t_msh *msh)
{
/* TODO: norme */
- pid_t pid;
+ pid_t pid[2];
int32_t pipefd[2];
int32_t status;
pipe(pipefd);
- if ((pid = fork()) == 0)
+ if ((pid[0] = fork()) == 0)
{
close(pipefd[0]);
dup2(pipefd[1], STDOUT_FILENO);
ft_e_extern_child(fullpath[0], ptr->one, msh);
}
- else if (pid < 0)
+ else if (pid[0] < 0)
{
/* TODO: handle fork failed */
}
else
{
- if ((pid = fork()) == 0)
+ if ((pid[1] = fork()) == 0)
{
close(pipefd[1]);
dup2(pipefd[0], STDIN_FILENO);
@@ -65,9 +65,9 @@ static void
{
close(pipefd[0]);
close(pipefd[1]);
- waitpid(-1, &status, 0);
+ waitpid(pid[1], &status, 0);
}
- waitpid(-1, &status, 0);
+ waitpid(pid[0], &status, 0);
msh->ret = WEXITSTATUS(status);
}
}