From 4b80fef3f36659f1abe204bbf52867e13c5bc4ba Mon Sep 17 00:00:00 2001 From: Adam Joly Date: Tue, 9 Jul 2024 16:42:27 +0200 Subject: [PATCH] =?UTF-8?q?=E3=80=8C=E2=9C=A8=E3=80=8D=20feat:=20Added=20s?= =?UTF-8?q?ecurity=20to=20redirection=20fd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main.c | 28 ++++++++----------------- src/parsing/check_error/check_redir.c | 30 +++++++++++++++++++++++++++ 2 files changed, 39 insertions(+), 19 deletions(-) create mode 100644 src/parsing/check_error/check_redir.c diff --git a/src/main.c b/src/main.c index d9d299a..78aa710 100644 --- a/src/main.c +++ b/src/main.c @@ -6,7 +6,7 @@ /* By: mmoussou +#+ +:+ +#+ */ +/* +#+#+#+#+#+ +#+ */ +/* Created: 2024/07/09 16:32:21 by adjoly #+# #+# */ +/* Updated: 2024/07/09 16:39:44 by adjoly ### ########.fr */ +/* */ +/* ************************************************************************** */ + +#include "parsing.h" +#include "error_msg.h" + +bool check_redir(t_list *list) +{ + t_list *tmp; + t_cmd *cmd; + + tmp = list; + while (tmp) + { + cmd = (t_cmd *)tmp->content; + if (cmd->infile == -1 || cmd->outfile == -1) + return (send_error_parsing(ERROR_NO_FILE)); + tmp = tmp->next; + } + return (false); +}