Compare commits

..

No commits in common. "e7f8373b4a37cb099a269f067ac3a504817dccfe" and "8ea2e6c62009db4ca57ae3fd888efd2b4951fda6" have entirely different histories.

3 changed files with 7 additions and 12 deletions

4
cmd.c
View File

@ -23,8 +23,8 @@ void ft_cmddel(void *ptr)
if (content->executable != NULL) if (content->executable != NULL)
free(content->executable); free(content->executable);
if (content->fd_in > 2) if (content->fd_in > 2)
close(content->fd_in); close(content->fd_out);
if (content->fd_out > 2) if (content->fd_in > 2)
close(content->fd_out); close(content->fd_out);
free(content); free(content);
} }

View File

@ -118,21 +118,17 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd)
else if (ft_strcmp(cmd->executable, "exit") == 0) else if (ft_strcmp(cmd->executable, "exit") == 0)
{ {
exit_code = ft_exit(cmd->args + 1); exit_code = ft_exit(cmd->args + 1);
if (exit_code > -1) if (exit_code != -1)
{ {
data->exit_code = exit_code; data->exit_code = exit_code;
return_code = -2; return_code = -2;
} }
else
{
data->exit_code = 1;
return_code = -3;
} }
}
if (return_code >= 0)
data->exit_code = return_code;
if (return_code != -1) if (return_code != -1)
{
cmd->executable = NULL; cmd->executable = NULL;
data->exit_code = return_code;
}
return (return_code); return (return_code);
} }

View File

@ -38,7 +38,6 @@ static char *ft_spacer_after(const char *str)
if (out == NULL) if (out == NULL)
return (NULL); return (NULL);
} }
if (out[i] != '\0')
i++; i++;
} }
return (out); return (out);