summaryrefslogtreecommitdiffstats
path: root/src/e_externs_pipes.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-09-15 19:59:41 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-09-15 19:59:41 +0200
commitca2e36781039eb7e9901ccde395600e7af87ff4f (patch)
tree8a9d85433e943fbbd079bc55700e048a54d9bf24 /src/e_externs_pipes.c
parenttype builtin fix (diff)
download42-minishell-ca2e36781039eb7e9901ccde395600e7af87ff4f.tar.gz
42-minishell-ca2e36781039eb7e9901ccde395600e7af87ff4f.tar.bz2
42-minishell-ca2e36781039eb7e9901ccde395600e7af87ff4f.tar.xz
42-minishell-ca2e36781039eb7e9901ccde395600e7af87ff4f.tar.zst
42-minishell-ca2e36781039eb7e9901ccde395600e7af87ff4f.zip
Huge fixes and stack stuff
Diffstat (limited to 'src/e_externs_pipes.c')
-rw-r--r--src/e_externs_pipes.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/e_externs_pipes.c b/src/e_externs_pipes.c
index e6252e4..05a2cf7 100644
--- a/src/e_externs_pipes.c
+++ b/src/e_externs_pipes.c
@@ -16,16 +16,17 @@
#include <stdint.h>
#include <unistd.h>
#include <string.h>
+#include <limits.h>
#include <errno.h>
#include "d_define.h"
-#include "e_externs_next.h"
#include "f_fail.h"
#include "m_redirs.h"
#include "s_destroy.h"
#include "s_line.h"
#include "s_lpipes.h"
#include "s_struct.h"
+#include "u_path.h"
#include "u_utils.h"
static uint8_t
@@ -143,8 +144,8 @@ void
{
struct s_lpipes *head;
struct s_lpipes *rptr;
- char **envpath;
char **fullpath;
+ char tmp[PATH_MAX];
size_t i;
size_t pipes;
uint8_t bu_id;
@@ -163,7 +164,7 @@ void
if ((fullpath[i] = ft_strdup(rptr->com->bin)) == NULL)
f_alloc_and_destroy_msh(msh);
}
- else if ((envpath = get_env_path(msh)) != NULL)
+ else
{
if ((bu_id = get_builtin_id(rptr->com->bin, msh))
< FT_BUILTINS_COUNT)
@@ -172,8 +173,10 @@ void
f_alloc_and_destroy_msh(msh);
}
else
- fullpath[i] = search_in_path(rptr->com->bin, envpath, msh);
- ft_delwords(envpath);
+ {
+ u_search_in_path(tmp, rptr->com->bin, PATH_MAX, msh);
+ fullpath[i] = ft_strdup(tmp);
+ }
}
i++;
rptr = rptr->next;