fixed close() of c->script_fd
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* 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);
|
||||
|
||||
Reference in New Issue
Block a user