fix segv env -i crash
This commit is contained in:
parent
9f538eabd1
commit
f33a98bff3
1 changed files with 8 additions and 4 deletions
|
|
@ -6,7 +6,7 @@
|
||||||
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
|
||||||
/* +#+#+#+#+#+ +#+ */
|
/* +#+#+#+#+#+ +#+ */
|
||||||
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
|
/* Created: 2016/11/28 19:26:32 by jhalford #+# #+# */
|
||||||
/* Updated: 2017/03/16 23:25:46 by ariard ### ########.fr */
|
/* Updated: 2017/03/17 17:41:33 by gwojda ### ########.fr */
|
||||||
/* */
|
/* */
|
||||||
/* ************************************************************************** */
|
/* ************************************************************************** */
|
||||||
|
|
||||||
|
|
@ -27,9 +27,13 @@ int data_init(int ac, char **av)
|
||||||
data->local_var = NULL;
|
data->local_var = NULL;
|
||||||
builtin_setenv(NULL, (char *[]){"local", "IFS", "\n ", 0}, NULL);
|
builtin_setenv(NULL, (char *[]){"local", "IFS", "\n ", 0}, NULL);
|
||||||
set_exitstatus(0, 1);
|
set_exitstatus(0, 1);
|
||||||
shlvl = ft_itoa(ft_atoi(ft_getenv(data->env, "SHLVL")) + 1);
|
shlvl = ft_getenv(data->env, "SHLVL");
|
||||||
|
if (shlvl)
|
||||||
|
{
|
||||||
|
shlvl = ft_itoa(ft_atoi(shlvl) + 1);
|
||||||
builtin_setenv(NULL, (char *[]){"setenv", "SHLVL", shlvl, 0}, NULL);
|
builtin_setenv(NULL, (char *[]){"setenv", "SHLVL", shlvl, 0}, NULL);
|
||||||
ft_strdel(&shlvl);
|
ft_strdel(&shlvl);
|
||||||
|
}
|
||||||
data->comp = NULL;
|
data->comp = NULL;
|
||||||
data->opts = 0;
|
data->opts = 0;
|
||||||
exec_reset();
|
exec_reset();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue