diff --git a/src/executing/simple_cmd/builtin_cd.c b/src/executing/simple_cmd/builtin_cd.c index 024ad39..733219a 100644 --- a/src/executing/simple_cmd/builtin_cd.c +++ b/src/executing/simple_cmd/builtin_cd.c @@ -3,10 +3,10 @@ /* ::: :::::::: */ /* builtin_cd.c :+: :+: :+: */ /* +:+ +:+ +:+ */ -/* By: jguelen +#+ +:+ +#+ */ +/* By: khais +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2025/03/31 16:20:17 by khais #+# #+# */ -/* Updated: 2025/04/07 17:35:16 by jguelen ### ########.fr */ +/* Updated: 2025/04/25 16:07:25 by khais ### ########.fr */ /* */ /* ************************************************************************** */ @@ -14,10 +14,12 @@ #include "libft.h" #include #include "../../env/env_manip.h" -#include "../../ft_errno.h" +#include static void ft_chdir(char *path, t_minishell *app) { + int saveerrno; + if (path[0] == '\0') app->last_return_value = 0; else if (chdir(path) == 0) @@ -25,8 +27,9 @@ static void ft_chdir(char *path, t_minishell *app) else { app->last_return_value = 1; - ft_errno(FT_EERRNO); - ft_perror("minishell: cd"); + saveerrno = errno; + ft_dprintf(STDERR_FILENO, "minishell: cd: %s: %s\n", path, + strerror(saveerrno)); } } diff --git a/test.sh b/test.sh index e1cc80f..fc6bbd9 100755 --- a/test.sh +++ b/test.sh @@ -243,11 +243,13 @@ when_run <