mirror of
https://codeberg.org/la-chouette/minishell.git
synced 2025-12-06 07:28:09 +01:00
fix(waitpid): remove spurious call & handle errors
This commit is contained in:
parent
505a96eeef
commit
255a1382da
2 changed files with 11 additions and 4 deletions
|
|
@ -6,7 +6,7 @@
|
|||
/* By: khais <marvin@42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/04/04 19:55:22 by khais #+# #+# */
|
||||
/* Updated: 2025/04/04 19:55:59 by khais ### ########.fr */
|
||||
/* Updated: 2025/04/28 12:29:50 by khais ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
|
|
@ -14,12 +14,18 @@
|
|||
#include "libft.h"
|
||||
#include <signal.h>
|
||||
#include <sys/wait.h>
|
||||
#include <stdio.h>
|
||||
|
||||
void do_waitpid(t_minishell *app, int pid)
|
||||
{
|
||||
int wstatus;
|
||||
|
||||
waitpid(pid, &wstatus, 0);
|
||||
wstatus = 0;
|
||||
if (waitpid(pid, &wstatus, 0) == -1)
|
||||
{
|
||||
app->last_return_value = 255;
|
||||
perror("waitpid");
|
||||
}
|
||||
if (WIFEXITED(wstatus))
|
||||
app->last_return_value = WEXITSTATUS(wstatus);
|
||||
if (WIFSIGNALED(wstatus))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue