Merge branch 'master' of https://git.chauvet.pro/starnakin/minishell
This commit is contained in:
commit
6a81705b98
12
main.c
12
main.c
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
|
/* Created: 2023/02/16 15:16:14 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/03/30 12:41:52 by cchauvet ### ########.fr */
|
/* Updated: 2023/03/30 13:12:41 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -43,17 +43,17 @@ static char *ft_get_user_input(void)
|
|||||||
static void ft_cmds_waiter(t_data *data)
|
static void ft_cmds_waiter(t_data *data)
|
||||||
{
|
{
|
||||||
t_list *current;
|
t_list *current;
|
||||||
t_cmd *content;
|
t_cmd *cmd;
|
||||||
int exit_status;
|
int exit_status;
|
||||||
|
|
||||||
current = *data->cmds;
|
current = *data->cmds;
|
||||||
while (current != NULL)
|
while (current != NULL)
|
||||||
{
|
{
|
||||||
content = current->content;
|
cmd = current->content;
|
||||||
if (content->executable != NULL && content->own_cmd == 0
|
if (cmd->executable != NULL && cmd->own_cmd == 0
|
||||||
&& content->pid != -1 && content->fd_in[0] != -2 && content->fd_out[0] != -2)
|
&& cmd->pid != -1 && cmd->fd_in[0] != -2 && cmd->fd_out[0] != -2)
|
||||||
{
|
{
|
||||||
waitpid(content->pid, &exit_status, 0);
|
waitpid(cmd->pid, &exit_status, 0);
|
||||||
if (WIFSIGNALED(exit_status))
|
if (WIFSIGNALED(exit_status))
|
||||||
{
|
{
|
||||||
if (WTERMSIG(exit_status) == SIGKILL)
|
if (WTERMSIG(exit_status) == SIGKILL)
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
/* By: cchauvet <cchauvet@student.42angoulem +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2023/02/15 17:36:11 by cchauvet #+# #+# */
|
/* Created: 2023/02/15 17:36:11 by cchauvet #+# #+# */
|
||||||
/* Updated: 2023/02/15 17:41:13 by cchauvet ### ########.fr */
|
/* Updated: 2023/03/30 13:26:31 by cchauvet ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
@ -54,7 +54,8 @@ int ft_file_is_writable(t_data *data, const char *path)
|
|||||||
ft_eprintf("minishell: %s: Permission denied\n", path);
|
ft_eprintf("minishell: %s: Permission denied\n", path);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
return (fd);
|
close(fd);
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ft_file_is_appendable(t_data *data, const char *path)
|
int ft_file_is_appendable(t_data *data, const char *path)
|
||||||
@ -76,5 +77,6 @@ int ft_file_is_appendable(t_data *data, const char *path)
|
|||||||
ft_eprintf("minishell: %s: Permission denied\n", path);
|
ft_eprintf("minishell: %s: Permission denied\n", path);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
return (fd);
|
close(fd);
|
||||||
|
return (1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user