diff options
author | salad <fmoenne-@student.le-101.fr> | 2020-08-29 19:47:08 +0200 |
---|---|---|
committer | salad <fmoenne-@student.le-101.fr> | 2020-08-29 19:47:08 +0200 |
commit | 670e296bee4082214c8ae4e956bdcc41e1260234 (patch) | |
tree | e45711246afd752330a6b1d1360dad1b2f6e0106 /src | |
parent | testing for nothing (diff) | |
download | 42-minishell-670e296bee4082214c8ae4e956bdcc41e1260234.tar.gz 42-minishell-670e296bee4082214c8ae4e956bdcc41e1260234.tar.bz2 42-minishell-670e296bee4082214c8ae4e956bdcc41e1260234.tar.xz 42-minishell-670e296bee4082214c8ae4e956bdcc41e1260234.tar.zst 42-minishell-670e296bee4082214c8ae4e956bdcc41e1260234.zip |
no more SEGV on e_externs_pipes if prog member is nonsense
Diffstat (limited to '')
-rw-r--r-- | src/c_init.c | 2 | ||||
-rw-r--r-- | src/e_externs_pipes.c | 5 | ||||
-rw-r--r-- | 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) { |