diff options
| author | Charles Cabergs <me@cacharle.xyz> | 2020-10-09 09:16:17 +0200 |
|---|---|---|
| committer | Charles Cabergs <me@cacharle.xyz> | 2020-10-09 09:16:17 +0200 |
| commit | 97e7e9b9934f99fbc659445512b19a525802726c (patch) | |
| tree | c4d9f3aa6ce75b5c85758f69d82931b000269899 /src/path.c | |
| parent | 7765a1e2c54759382312c4a611b24ae4f226e64f (diff) | |
| download | minishell-97e7e9b9934f99fbc659445512b19a525802726c.tar.gz minishell-97e7e9b9934f99fbc659445512b19a525802726c.tar.bz2 minishell-97e7e9b9934f99fbc659445512b19a525802726c.zip | |
Fixing empty PATH variable bug
Diffstat (limited to 'src/path.c')
| -rw-r--r-- | src/path.c | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -6,7 +6,7 @@ /* By: cacharle <marvin@42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2020/02/27 15:51:01 by cacharle #+# #+# */ -/* Updated: 2020/10/07 12:24:27 by cacharle ### ########.fr */ +/* Updated: 2020/10/09 09:15:09 by cacharle ### ########.fr */ /* */ /* ************************************************************************** */ @@ -66,7 +66,14 @@ int path_search( return (st_path_check(exec_path, false)); } if ((current_dir = env_search(env, "PATH", NULL)) == NULL) - return (st_dir_search(getcwd(cwd, PATH_MAX + 1), exec_name, exec_path)); + return (st_path_check(ft_strcpy(exec_path, exec_name), false)); + if (*current_dir == '\0') + { + ft_strcpy(exec_path, exec_name); + if (print) + return (st_path_check(exec_name, false)); + return (0); + } while ((collon = ft_strchr(current_dir, ':')) != NULL) { *collon = '\0'; |
