diff --git a/srcs/misc/free.c b/srcs/misc/free.c index 0e0ae5f..d81bf35 100644 --- a/srcs/misc/free.c +++ b/srcs/misc/free.c @@ -6,7 +6,7 @@ /* By: lperrey +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/10/10 23:53:17 by lperrey #+# #+# */ -/* Updated: 2021/12/20 22:47:26 by lperrey ### ########.fr */ +/* Updated: 2021/12/21 12:14:43 by lperrey ### ########.fr */ /* */ /* ************************************************************************** */ @@ -22,9 +22,12 @@ int exit_free(t_all *c, int exit_status) free_pipeline(&c->pipeline); if (c->script_fd) { - gnl(c->script_fd, NULL, 1); - if (close(c->script_fd) == -1) - perror("close()"); + if (c->script_fd > 0) + { + gnl(c->script_fd, NULL, 1); + if (close(c->script_fd) == -1) + perror("close()"); + } } else if (!isatty(STDIN_FILENO)) gnl(STDIN_FILENO, NULL, 1);