diff --git a/srcs/exec.c b/srcs/exec.c index 5395e2f..c19938c 100755 --- a/srcs/exec.c +++ b/srcs/exec.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/07 14:12:49 by tomoron #+# #+# */ -/* Updated: 2024/02/27 18:44:14 by marde-vr ### ########.fr */ +/* Updated: 2024/02/27 19:20:14 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -110,7 +110,6 @@ void free_msh(t_msh *msh) void ft_exit(t_msh *msh, int exit_code) { - ft_printf_fd(2, "exiting"); free_msh(msh); exit(exit_code); } @@ -379,7 +378,10 @@ void get_out_type(t_msh *msh) msh->out_fd = open(cur_cmd->next->token, O_CREAT | O_RDWR | O_APPEND, 0644); if (msh->out_fd == -1) + { + perror("open"); ft_exit(msh, 2); + } } } diff --git a/srcs/here_doc.c b/srcs/here_doc.c index decb884..880eb85 100644 --- a/srcs/here_doc.c +++ b/srcs/here_doc.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/26 20:20:31 by marde-vr #+# #+# */ -/* Updated: 2024/02/26 20:40:00 by marde-vr ### ########.fr */ +/* Updated: 2024/02/27 19:23:08 by marde-vr ### ########.fr */ /* */ /* ************************************************************************** */ @@ -91,11 +91,19 @@ void handle_here_doc(t_msh *msh, char *eof) here_doc_file = get_tmp_file_name(msh); msh->in_fd = open(here_doc_file, O_CREAT | O_RDWR, 0644); if (msh->in_fd == -1) + { + perror("open"); ft_exit(msh, 2); + } eof = ft_strjoin_free(eof, "\n", 1); if (!eof) ft_exit(msh, 1); get_here_doc_input(msh, eof); close(msh->in_fd); msh->in_fd = open(here_doc_file, O_RDWR, 0644); + if (msh->in_fd == -1) + { + perror("open"); + ft_exit(msh, 2); + } }