fix segv env -i crash

This commit is contained in:
gwojda 2017-03-17 17:42:41 +01:00
parent 9f538eabd1
commit f33a98bff3

View file

@ -6,7 +6,7 @@
/* By: jhalford <jhalford@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* 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;
builtin_setenv(NULL, (char *[]){"local", "IFS", "\n ", 0}, NULL);
set_exitstatus(0, 1);
shlvl = ft_itoa(ft_atoi(ft_getenv(data->env, "SHLVL")) + 1);
builtin_setenv(NULL, (char *[]){"setenv", "SHLVL", shlvl, 0}, NULL);
ft_strdel(&shlvl);
shlvl = ft_getenv(data->env, "SHLVL");
if (shlvl)
{
shlvl = ft_itoa(ft_atoi(shlvl) + 1);
builtin_setenv(NULL, (char *[]){"setenv", "SHLVL", shlvl, 0}, NULL);
ft_strdel(&shlvl);
}
data->comp = NULL;
data->opts = 0;
exec_reset();