fix: heredoc fd not closed

This commit is contained in:
Camille Chauvet 2023-03-31 15:32:21 +02:00
parent 88d955fddc
commit d9ae113b94

View File

@ -6,7 +6,7 @@
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */ /* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2023/02/17 15:36:26 by cchauvet #+# #+# */ /* Created: 2023/02/17 15:36:26 by cchauvet #+# #+# */
/* Updated: 2023/03/31 15:28:31 by alouis-j ### ########.fr */ /* Updated: 2023/03/31 15:31:58 by alouis-j ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@ -72,8 +72,12 @@ int ft_heredoc(t_data *data, char *stop)
if (return_code == 2) if (return_code == 2)
break ; break ;
else if (return_code) else if (return_code)
{
close(*ft_get_heredoc())
return (-2); return (-2);
}
} }
close(*ft_get_heredoc())
close(fds[1]); close(fds[1]);
*ft_get_heredoc() = -1; *ft_get_heredoc() = -1;
return (fds[0]); return (fds[0]);