diff options
author | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-30 20:30:58 +0200 |
---|---|---|
committer | JozanLeClerc <bousset.rudy@gmail.com> | 2020-07-30 20:30:58 +0200 |
commit | c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c (patch) | |
tree | c5a7655d5fa858da43b0c9e3f1f616d269aae172 /src/e_externs.c | |
parent | Work in progress, freed leak (diff) | |
download | 42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.gz 42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.bz2 42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.xz 42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.tar.zst 42-minishell-c19bd35afdb45e49cebdfd96e7adb1e6fe477f0c.zip |
Double exit no more
Diffstat (limited to '')
-rw-r--r-- | src/e_externs.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/e_externs.c b/src/e_externs.c index d7c4854..3d55fa9 100644 --- a/src/e_externs.c +++ b/src/e_externs.c @@ -17,6 +17,7 @@ #include <unistd.h> #include "e_externs_next.h" +#include "f_fail.h" #include "m_redirs.h" #include "s_destroy.h" #include "s_lcom.h" @@ -72,8 +73,15 @@ void { fullpath = search_in_path(ptr->com, envpath, msh); ft_delwords(envpath); + if (fullpath == NULL) + { + f_fail_command_not_found(ptr->com); + /* TODO: deal if not found etc */ + } + else + { + exec_path(fullpath, ptr, msh); + ft_memdel((void*)&fullpath); + } } - /* TODO: deal if not found etc */ - exec_path(fullpath, ptr, msh); - ft_memdel((void*)&fullpath); } |