replaced occurrences of last exit_status

+ deleted envp comments
+ WIP Macro exit status
+ TODO : Invalid free of environ in readline
This commit is contained in:
LuckyLaszlo
2021-11-27 12:59:16 +01:00
parent 843b6d84c5
commit 3baf91afb3
16 changed files with 59 additions and 65 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/11/16 01:57:38 by lperrey #+# #+# */
/* Updated: 2021/11/18 23:09:46 by hulamy ### ########.fr */
/* Updated: 2021/11/27 10:43:46 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,7 +14,7 @@
static int handle_wait_error(void);
void wait_subshell(pid_t last_cmd_pid, int *last_exit_status)
void wait_subshell(pid_t last_cmd_pid)
{
int wstatus;
int ret;
@@ -25,11 +25,11 @@ void wait_subshell(pid_t last_cmd_pid, int *last_exit_status)
if (waitpid(last_cmd_pid, &wstatus, 0) == -1)
perror("waitpid()");
if (WIFEXITED(wstatus))
*last_exit_status = WEXITSTATUS(wstatus);
set_last_exit_status(WEXITSTATUS(wstatus));
if (WIFSIGNALED(wstatus))
{
write(STDIN_FILENO, "\n", 1);
*last_exit_status = 128 + WTERMSIG(wstatus);
set_last_exit_status(EXIT_SIGNAL + WTERMSIG(wstatus));
}
}
ret = 0;