fixed crash in builtin export with "" argument

+ builtin unset now update PATH
This commit is contained in:
LuckyLaszlo
2021-12-18 13:45:20 +01:00
parent fa474c86ab
commit 0e520ef31e
2 changed files with 6 additions and 2 deletions

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/12/05 17:05:05 by lperrey #+# #+# */
/* Updated: 2021/12/05 18:14:28 by lperrey ### ########.fr */
/* Updated: 2021/12/18 13:41:15 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -27,6 +27,8 @@ int builtin_unset(int argc, char *argv[], t_all *c)
{
if (unset_env_var(argv[i]) == EXIT_FAILURE)
exit_value = EXIT_FAILURE;
if (ft_strncmp(argv[i], "PATH", 4 + 1) == 0)
c->path = retrieve_path();
i++;
}
return (exit_value);

View File

@@ -6,7 +6,7 @@
/* By: lperrey <lperrey@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2021/10/08 09:25:35 by lperrey #+# #+# */
/* Updated: 2021/12/16 03:50:43 by lperrey ### ########.fr */
/* Updated: 2021/12/18 13:31:11 by lperrey ### ########.fr */
/* */
/* ************************************************************************** */
@@ -16,6 +16,8 @@ int ft_is_posix_name(char *str)
{
unsigned int i;
if (!str)
return (0);
if (str[0] != '_' && !ft_isalpha(str[0]))
return (0);
i = 1;