From b4852dd53af7d26e1baff63cee74ab80c01b9ee6 Mon Sep 17 00:00:00 2001 From: wescande Date: Wed, 22 Mar 2017 22:02:11 +0100 Subject: [PATCH] rectif msg command not found + segv on no right directory --- 42sh/src/exec/plaunch_file.c | 4 ++-- 42sh/src/glob/dir_glob.c | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/42sh/src/exec/plaunch_file.c b/42sh/src/exec/plaunch_file.c index 4c3a4050..a9e66228 100644 --- a/42sh/src/exec/plaunch_file.c +++ b/42sh/src/exec/plaunch_file.c @@ -6,7 +6,7 @@ /* By: jhalford +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/03/07 14:53:31 by jhalford #+# #+# */ -/* Updated: 2017/03/20 16:29:20 by gwojda ### ########.fr */ +/* Updated: 2017/03/22 21:32:36 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,7 +14,7 @@ static void error_launch(char *error_ori, char *error_type, int error_code) { - SH_ERR("%s: %s%s", SHELL_NAME, error_ori, error_type); + SH_ERR("%s%s", error_ori, error_type); exit(error_code); } diff --git a/42sh/src/glob/dir_glob.c b/42sh/src/glob/dir_glob.c index 0a5e0361..d7736c1c 100644 --- a/42sh/src/glob/dir_glob.c +++ b/42sh/src/glob/dir_glob.c @@ -6,7 +6,7 @@ /* By: wescande +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2017/01/30 12:07:16 by wescande #+# #+# */ -/* Updated: 2017/03/14 23:14:19 by wescande ### ########.fr */ +/* Updated: 2017/03/22 21:59:49 by wescande ### ########.fr */ /* */ /* ************************************************************************** */ @@ -63,7 +63,8 @@ int dir_research(t_glob *gl, char *p, } if ((ft_strlen(p) <= 1 || p[ft_strlen(p) - 1] != '.') && is_directory(p)) { - dir = opendir(p); + if (!(dir = opendir(p))) + return (0); while ((in = readdir(dir))) dir_list_content(gl, (char *[2]){p, in->d_name}, pat, mode[0]);