summaryrefslogtreecommitdiffstats
path: root/src/s_lredir.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/s_lredir.c')
-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);