summaryrefslogtreecommitdiffstats
path: root/src/s_lredir.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-10-22 18:49:41 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-10-22 18:49:41 +0200
commitca88bc609950ebe3f84b4a5cadeb069fc3aded14 (patch)
tree38a9791a5acd7554bcceaaae86e0b9403b119d7d /src/s_lredir.c
parentIn progress (diff)
download42-minishell-ca88bc609950ebe3f84b4a5cadeb069fc3aded14.tar.gz
42-minishell-ca88bc609950ebe3f84b4a5cadeb069fc3aded14.tar.bz2
42-minishell-ca88bc609950ebe3f84b4a5cadeb069fc3aded14.tar.xz
42-minishell-ca88bc609950ebe3f84b4a5cadeb069fc3aded14.tar.zst
42-minishell-ca88bc609950ebe3f84b4a5cadeb069fc3aded14.zip
Unfinished
Diffstat (limited to '')
-rw-r--r--src/s_lredir.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/s_lredir.c b/src/s_lredir.c
index 0457434..109f313 100644
--- a/src/s_lredir.c
+++ b/src/s_lredir.c
@@ -64,6 +64,14 @@ void s_lredir_clear(struct s_lredir **lredir)
*lredir = NULL;
}
+static int32_t s_get_right_fd(const char path[])
+{
+ int32_t rfd;
+
+ rfd = 0;
+ return (rfd);
+}
+
struct s_lredir *s_lredir_new(const char path[], int32_t fd, int8_t redir)
{
struct s_lredir *rdr;
@@ -72,6 +80,8 @@ struct s_lredir *s_lredir_new(const char path[], int32_t fd, int8_t redir)
return (NULL);
rdr->fd = fd;
rdr->right_fd = -1;
+ if (redir == 3 && rdr->right_fd = s_get_right_fd(path) == -1)
+ return (NULL);
rdr->redir = redir;
rdr->next = NULL;
ft_strlcpy(rdr->path, path, PATH_MAX);