Compare commits
13 Commits
8ea2e6c620
...
e7f8373b4a
Author | SHA1 | Date | |
---|---|---|---|
|
e7f8373b4a | ||
|
9cbb1e139a | ||
|
06f6308bc4 | ||
|
b2c7013cf9 | ||
|
7f4fd9d421 | ||
|
af7336fbf3 | ||
|
4342d9a015 | ||
|
e0e329a355 | ||
|
5541a1f3fe | ||
|
b914753c47 | ||
|
9a5cca3e2d | ||
|
77620211da | ||
|
07bc37cc71 |
4
cmd.c
4
cmd.c
@ -23,8 +23,8 @@ void ft_cmddel(void *ptr)
|
||||
if (content->executable != NULL)
|
||||
free(content->executable);
|
||||
if (content->fd_in > 2)
|
||||
close(content->fd_out);
|
||||
if (content->fd_in > 2)
|
||||
close(content->fd_in);
|
||||
if (content->fd_out > 2)
|
||||
close(content->fd_out);
|
||||
free(content);
|
||||
}
|
||||
|
14
execution.c
14
execution.c
@ -118,17 +118,21 @@ static int ft_own_cmd(t_data *data, t_cmd *cmd)
|
||||
else if (ft_strcmp(cmd->executable, "exit") == 0)
|
||||
{
|
||||
exit_code = ft_exit(cmd->args + 1);
|
||||
if (exit_code != -1)
|
||||
if (exit_code > -1)
|
||||
{
|
||||
data->exit_code = exit_code;
|
||||
return_code = -2;
|
||||
}
|
||||
else
|
||||
{
|
||||
data->exit_code = 1;
|
||||
return_code = -3;
|
||||
}
|
||||
}
|
||||
if (return_code != -1)
|
||||
{
|
||||
cmd->executable = NULL;
|
||||
if (return_code >= 0)
|
||||
data->exit_code = return_code;
|
||||
}
|
||||
if (return_code != -1)
|
||||
cmd->executable = NULL;
|
||||
return (return_code);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user