fix un truc

This commit is contained in:
2024-05-06 13:42:47 +02:00
parent 231f1a8002
commit 60d6e50ab9
3 changed files with 7 additions and 12 deletions

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/02/21 21:47:15 by marde-vr #+# #+# */
/* Updated: 2024/05/03 12:51:56 by marde-vr ### ########.fr */
/* Updated: 2024/05/06 13:37:25 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -99,9 +99,8 @@ void get_cmd_path(t_msh *msh)
ft_printf_fd(2, "'': command not found\n");
else
ft_printf_fd(2, "%s: command not found\n", msh->tokens->value);
free(msh->tokens->value);
msh->tokens->value = 0;
//free(msh->tokens->value);
//msh->tokens->value = 0;
g_return_code = 127;
msh->in_fd = -2;
}
}

View File

@ -6,7 +6,7 @@
/* By: marde-vr <marde-vr@42angouleme.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2024/03/05 18:17:25 by marde-vr #+# #+# */
/* Updated: 2024/05/03 13:13:36 by marde-vr ### ########.fr */
/* Updated: 2024/05/06 13:41:24 by tomoron ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,9 +18,9 @@ void close_pipe_fds(t_msh *msh, int i)
{
if (i != 0)
{
if (msh->fds[i - 1][0] > 2)
if (msh->fds[i - 1] && msh->fds[i - 1][0] > 2)
close(msh->fds[i - 1][0]);
if (msh->fds[i - 1][1] > 2)
if (msh->fds[i - 1] && msh->fds[i - 1][1] > 2)
close(msh->fds[i - 1][1]);
}
if (msh->fds[i] && msh->fds[i][0] > 2)
@ -74,10 +74,7 @@ void execute_command(t_msh *msh, char **cmd_args)
{
env = env_to_char_tab(msh->env);
if (env)
{
if (execve(msh->tokens->value, cmd_args, env))
perror("execve");
}
execve(msh->tokens->value, cmd_args, env);
ft_free_str_arr(env);
}
}