close_stdio() at exit
This commit is contained in:
11
srcs/free.c
11
srcs/free.c
@@ -23,6 +23,7 @@ int exit_free(t_all *c, int exit_status)
|
||||
//if (c->termios_changed)
|
||||
// tcsetattr(STDIN_FILENO, TCSANOW, &c->ori_termios);
|
||||
rl_clear_history();
|
||||
close_stdio();
|
||||
exit(exit_status);
|
||||
}
|
||||
|
||||
@@ -70,3 +71,13 @@ void close_pipeline_fd(t_cmd *pipeline[])
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
void close_stdio(void)
|
||||
{
|
||||
if (close(STDIN_FILENO) == -1)
|
||||
perror("close()");
|
||||
if (close(STDOUT_FILENO) == -1)
|
||||
perror("close()");
|
||||
if (close(STDERR_FILENO) == -1)
|
||||
perror("close()");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user