From 9e8855a9ef6d2c7c9f54091f2037f92b4c6ceec5 Mon Sep 17 00:00:00 2001 From: Jack Halford Date: Wed, 22 Mar 2017 00:38:04 +0100 Subject: [PATCH] env ./42sh still making problems --- 42sh/includes/exec.h | 2 +- 42sh/src/exec/process_launch.c | 2 +- 42sh/src/glob/command_getoutput.c | 7 +++---- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/42sh/includes/exec.h b/42sh/includes/exec.h index f4e7419e..d0ee6e3c 100644 --- a/42sh/includes/exec.h +++ b/42sh/includes/exec.h @@ -140,7 +140,7 @@ struct s_exec }; int exec_reset(void); -int do_the_muther_forker(t_process *p); +int process_fork(t_process *p); int process_setgroup(t_process *p, pid_t pid); void process_setsig(void); void process_reset(t_process *p); diff --git a/42sh/src/exec/process_launch.c b/42sh/src/exec/process_launch.c index 4cf71ad5..c7b959ff 100644 --- a/42sh/src/exec/process_launch.c +++ b/42sh/src/exec/process_launch.c @@ -51,7 +51,7 @@ int process_launch(t_process *p) process_free(p, 0); return (1); } - p->pid = process_fork(p): + p->pid = process_fork(p); process_setgroup(p, p->pid); if (p->fdin != STDIN) close(p->fdin); diff --git a/42sh/src/glob/command_getoutput.c b/42sh/src/glob/command_getoutput.c index 18da3edc..8bd80bbb 100644 --- a/42sh/src/glob/command_getoutput.c +++ b/42sh/src/glob/command_getoutput.c @@ -21,8 +21,7 @@ static char *manage_output(int *fds) output = NULL; close(fds[PIPE_WRITE]); - while ((ret = read(fds[PIPE_READ], buf, BUF_SIZE)) > 0) - { + while ((ret = read(fds[PIPE_READ], buf, BUF_SIZE)) > 0) { buf[ret] = 0; ft_strappend(&output, buf); } @@ -89,7 +88,7 @@ char *command_getoutput(char *command) if (!command) return (NULL); pipe(fds); - if (!(pid = do_the_muther_forker(NULL))) + if (!(pid = process_fork(NULL))) { close(fds[PIPE_READ]); dup2_close(fds[PIPE_WRITE], STDOUT); @@ -110,7 +109,7 @@ int command_setoutput(char *const av[], char **env) if (!av) return (0); pid = 0; - if (!(pid = do_the_muther_forker(NULL))) + if (!(pid = process_fork(NULL))) execute_command(av, env); return (pid); }