From 670e296bee4082214c8ae4e956bdcc41e1260234 Mon Sep 17 00:00:00 2001 From: salad Date: Sat, 29 Aug 2020 19:47:08 +0200 Subject: no more SEGV on e_externs_pipes if prog member is nonsense --- src/c_init.c | 2 +- src/e_externs_pipes.c | 5 ++++- src/m_loop.c | 1 - 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/c_init.c b/src/c_init.c index c5fc319..63e9e07 100644 --- a/src/c_init.c +++ b/src/c_init.c @@ -39,7 +39,7 @@ void c_process_key(t_caps *tcaps) { while ((bread = read(STDIN_FILENO, nread, sizeof(nread)) != 1)) { if (bread == -1) { - ft_printf("error on read"); + printf("error on read"); return ; } } diff --git a/src/e_externs_pipes.c b/src/e_externs_pipes.c index 858e60f..8556cbb 100644 --- a/src/e_externs_pipes.c +++ b/src/e_externs_pipes.c @@ -174,6 +174,9 @@ void rptr = rptr->next; } i = 0; - exec_path((const char**)fullpath, head, msh); + while (fullpath[i] != NULL) + i++; + if (i == (pipes + 1)) + exec_path((const char**)fullpath, head, msh); ft_delwords(fullpath); } diff --git a/src/m_loop.c b/src/m_loop.c index 75b8e3e..9df2fce 100644 --- a/src/m_loop.c +++ b/src/m_loop.c @@ -38,7 +38,6 @@ uint8_t char *line; int8_t gnl; - c_init_tcaps(); gnl = 1; while (gnl > 0) { -- cgit v1.2.3