diff --git a/execution.c b/execution.c index 0e61b42..0c06ad0 100644 --- a/execution.c +++ b/execution.c @@ -110,7 +110,7 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd) else if (ft_strcmp(cmd->executable, "export") == 0) return_code = (export(data->env,cmd->args + 1, cmd->fd_out)); else if (ft_strcmp(cmd->executable, "cd") == 0) - return_code = (move_folder(cmd->args[1], cmd->fd_out)); + return_code = (move_folder(cmd->args + 1, cmd->fd_out)); if (ft_strcmp(cmd->executable, "unset") == 0) return_code = (unset(data->env, cmd->args, cmd->fd_out)); else if (ft_strcmp(cmd->executable, "echo") == 0) @@ -124,7 +124,7 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd) return_code = -2; } } - if (return_code != -1) + if (return_code != -1 && return_code != -2) { cmd->executable = NULL; data->exit_code = return_code;