aboutsummaryrefslogtreecommitdiff
path: root/src/eval
diff options
context:
space:
mode:
authorCharles Cabergs <me@cacharle.xyz>2020-09-16 16:19:22 +0200
committerCharles Cabergs <me@cacharle.xyz>2020-09-16 16:19:22 +0200
commite439b71d807529734f04ce9d78b98c12022e7c72 (patch)
tree59125ee91455ac607aa064965073c0eed20b3573 /src/eval
parent0a8f2cf987a55d6e1c4b210f0f99a1a1e4e4460a (diff)
downloadminishell-e439b71d807529734f04ce9d78b98c12022e7c72.tar.gz
minishell-e439b71d807529734f04ce9d78b98c12022e7c72.tar.bz2
minishell-e439b71d807529734f04ce9d78b98c12022e7c72.zip
Refactoring main, all setup code in setup.c, disabled -c and -l flags if not tested
Diffstat (limited to 'src/eval')
-rw-r--r--src/eval/redir.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/eval/redir.c b/src/eval/redir.c
index 6c3e45c..0d830e2 100644
--- a/src/eval/redir.c
+++ b/src/eval/redir.c
@@ -6,7 +6,7 @@
/* By: charles <charles.cabergs@gmail.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/06/15 11:05:34 by charles #+# #+# */
-/* Updated: 2020/09/14 15:41:03 by charles ### ########.fr */
+/* Updated: 2020/09/16 16:17:09 by charles ### ########.fr */
/* */
/* ************************************************************************** */
@@ -14,6 +14,8 @@
static int st_open_replace(char *filename, int *fd, int oflag)
{
+ if (fd == NULL)
+ return (EVAL_FATAL);
if (*fd != FD_NONE)
close(*fd);
if (oflag & O_CREAT)
@@ -34,6 +36,8 @@ static int st_open_replace_dispatch(char *filename, int fds[2], enum e_tok tag)
int *fd;
int oflag;
+ fd = NULL;
+ oflag = 0;
if (tag == TAG_REDIR_IN)
{
fd = &fds[FD_READ];