Browse Source

fixed local find in PATH e.g.'./cat'

master
narnaud 3 years ago
parent
commit
1c676c8f2f
  1. 2
      README.md
  2. 3
      caller.c

2
README.md

@ -15,4 +15,4 @@
## Issues : ## Issues :
- error using unknow command with valgrind ## Notes :

3
caller.c

@ -54,6 +54,8 @@ void exe(t_datas *datas, t_command *cmd)
if (ft_strchr(cmd->argv[0], '/')) if (ft_strchr(cmd->argv[0], '/'))
execve(cmd->argv[0], cmd->argv, datas->envp); execve(cmd->argv[0], cmd->argv, datas->envp);
else
{
path_dirs = ft_split(getenv("PATH"), ':'); path_dirs = ft_split(getenv("PATH"), ':');
while (path_dirs) while (path_dirs)
{ {
@ -66,6 +68,7 @@ void exe(t_datas *datas, t_command *cmd)
free(path); free(path);
path_dirs++; path_dirs++;
} }
}
} }
pid_t caller(t_datas *datas, t_command *cmd) pid_t caller(t_datas *datas, t_command *cmd)

Loading…
Cancel
Save