fix: first cmd not found cause invalide read

This commit is contained in:
Camille Chauvet 2023-03-30 12:43:31 +02:00
parent f874ed9f7b
commit 011c801f1d

6
main.c
View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
/* Updated: 2023/03/29 18:48:50 by cchauvet ### ########.fr */
/* Updated: 2023/03/30 12:41:52 by cchauvet ### ########.fr */
/* */
/* ************************************************************************** */
@ -50,8 +50,8 @@ static void ft_cmds_waiter(t_data *data)
while (current != NULL)
{
content = current->content;
if (content->own_cmd == 0 && content->pid != -1
&& content->fd_in[0] != -2 && content->fd_out[0] != -2)
if (content->executable != NULL && content->own_cmd == 0
&& content->pid != -1 && content->fd_in[0] != -2 && content->fd_out[0] != -2)
{
waitpid(content->pid, &exit_status, 0);
if (WIFSIGNALED(exit_status))