From 43e4d054b5bc9e34cca20283dd29bde128db71cb Mon Sep 17 00:00:00 2001 From: tom moron Date: Sun, 5 May 2024 20:26:52 +0200 Subject: [PATCH] fix exit when variable on input redirection and invalid read --- srcs/input_redirections.c | 5 ++++- srcs/parsing_var.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/srcs/input_redirections.c b/srcs/input_redirections.c index 2765e77..7c2268e 100755 --- a/srcs/input_redirections.c +++ b/srcs/input_redirections.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/03/05 18:15:27 by marde-vr #+# #+# */ -/* Updated: 2024/05/03 14:11:52 by marde-vr ### ########.fr */ +/* Updated: 2024/05/05 20:10:03 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -40,7 +40,10 @@ int open_input_redirection_file(t_msh *msh, t_cmd **cur_token) if (msh->in_fd != 0) close(msh->in_fd); if (ft_strchr((*cur_token)->value, '$')) + { ambiguous_redirect((*cur_token)->value, msh); + return (1); + } filename = parse_tokens((*cur_token)->value, msh->env); if (!filename) ft_exit(msh, 1); diff --git a/srcs/parsing_var.c b/srcs/parsing_var.c index 88727b9..bab3a61 100755 --- a/srcs/parsing_var.c +++ b/srcs/parsing_var.c @@ -6,7 +6,7 @@ /* By: marde-vr +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2024/02/09 15:24:36 by tomoron #+# #+# */ -/* Updated: 2024/05/04 14:11:54 by tomoron ### ########.fr */ +/* Updated: 2024/05/05 20:21:43 by tomoron ### ########.fr */ /* */ /* ************************************************************************** */ @@ -29,7 +29,10 @@ int get_var_len(char **command, t_env *env) (*command)++; if (**command == '\'' || **command == '"') + { + (*command)--; return(0); + } if (!**command) return (1); if (!ft_isalnum(**command) && **command != '_' && **command != '?')