protected control loops from background 'raping'

This commit is contained in:
Jack Halford 2017-03-28 20:31:02 +02:00
parent 9ccb83ac17
commit 57546c0022
5 changed files with 9 additions and 8 deletions

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2016/11/27 20:29:56 by jhalford #+# #+# */
/* Updated: 2017/03/27 15:46:34 by jhalford ### ########.fr */
/* Updated: 2017/03/28 20:22:01 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -135,7 +135,6 @@ struct s_exec
int fdin;
t_list *op_stack;
char **case_pattern;
int control_count;
};
int exec_init(t_exec *exec);

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/15 00:49:20 by wescande #+# #+# */
/* Updated: 2017/03/24 14:52:00 by ariard ### ########.fr */
/* Updated: 2017/03/28 20:29:55 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -27,6 +27,7 @@ int plaunch_for(t_process *p)
return (SH_ERR(FORERR_0, var));
i = 0;
av = token_to_argv(temp, 1);
data_singleton()->exec.job.attrs &= ~JOB_BG;
while (av[++i])
{
builtin_setenv("setenv", (char*[]){"local", var, av[i], 0},

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 22:04:42 by wescande #+# #+# */
/* Updated: 2017/03/22 19:22:56 by jhalford ### ########.fr */
/* Updated: 2017/03/28 20:30:19 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,6 +17,7 @@ int plaunch_until(t_process *p)
int ret;
ret = 0;
data_singleton()->exec.job.attrs &= ~JOB_BG;
ft_exec(&p->data.d_until.condition);
while (ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0"))
{

View file

@ -6,7 +6,7 @@
/* By: wescande <wescande@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/07 17:20:53 by wescande #+# #+# */
/* Updated: 2017/03/24 22:43:37 by jhalford ### ########.fr */
/* Updated: 2017/03/28 20:29:54 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -17,6 +17,7 @@ int plaunch_while(t_process *p)
int ret;
ret = 0;
data_singleton()->exec.job.attrs &= ~JOB_BG;
ft_exec(&p->data.d_while.condition);
while (!(ft_strcmp(ft_getenv(data_singleton()->env, "?"), "0")))
{

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2017/03/13 22:21:19 by jhalford #+# #+# */
/* Updated: 2017/03/28 15:36:13 by wescande ### ########.fr */
/* Updated: 2017/03/28 20:29:23 by jhalford ### ########.fr */
/* */
/* ************************************************************************** */
@ -39,8 +39,7 @@ int process_fork(t_process *p)
int process_launch(t_process *p)
{
p->state = PROCESS_RUNNING;
if (!IS_PIPESINGLE(*p)
|| p->type == PROCESS_FILE
if (!IS_PIPESINGLE(*p) || p->type == PROCESS_FILE
|| p->type == PROCESS_SUBSHELL)
{
p->pid = process_fork(p);