summaryrefslogtreecommitdiffstats
path: root/src/e_externs_pipes.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-27 15:49:11 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-27 15:49:11 +0200
commit93e157bb48e8139e3988b7e0d3deca80dafd51b1 (patch)
tree024e8653cf8e040bc83ab0c9fd083d96a93af10a /src/e_externs_pipes.c
parentFreed leaks (diff)
download42-minishell-93e157bb48e8139e3988b7e0d3deca80dafd51b1.tar.gz
42-minishell-93e157bb48e8139e3988b7e0d3deca80dafd51b1.tar.bz2
42-minishell-93e157bb48e8139e3988b7e0d3deca80dafd51b1.tar.xz
42-minishell-93e157bb48e8139e3988b7e0d3deca80dafd51b1.tar.zst
42-minishell-93e157bb48e8139e3988b7e0d3deca80dafd51b1.zip
In progress
Diffstat (limited to 'src/e_externs_pipes.c')
-rw-r--r--src/e_externs_pipes.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/e_externs_pipes.c b/src/e_externs_pipes.c
index 858e60f..320b31d 100644
--- a/src/e_externs_pipes.c
+++ b/src/e_externs_pipes.c
@@ -26,6 +26,7 @@
#include "s_line.h"
#include "s_lpipes.h"
#include "s_struct.h"
+#include "u_utils.h"
static uint8_t
get_builtin_id(const char com[],
@@ -55,8 +56,10 @@ static void
{
bu_id = get_builtin_id(ptr->bin, msh);
ret = msh->bu_ptr[bu_id](ptr->argv + 1, msh);
+ u_eof_fd(msh->fd);
s_line_clear(&msh->curr);
s_destroy(msh);
+ ft_memdel((void*)&fullpath);
exit(ret);
}
else
@@ -82,13 +85,13 @@ static size_t
static void
exec_path(const char *fullpath[],
- struct s_lpipes *head,
- t_msh *msh)
+ struct s_lpipes *head,
+ t_msh *msh)
{
+ int fd[256][2];
size_t pipes;
size_t i;
size_t j;
- int fd[256][2];
int pid;
int status;
@@ -147,7 +150,7 @@ void
head = ptr;
rptr = ptr;
pipes = e_get_pipes_count(head);
- if (!(fullpath = (char **)malloc((pipes + 2) * sizeof(char *))))
+ if ((fullpath = (char **)malloc((pipes + 2) * sizeof(char *))) == NULL)
f_alloc_and_destroy_msh(msh);
fullpath[pipes + 1] = NULL;
i = 0;