multiple fixes
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
/* By: sede-san <sede-san@student.42madrid.com +#+ +:+ +#+ */
|
||||
/* +#+#+#+#+#+ +#+ */
|
||||
/* Created: 2025/12/01 09:12:39 by sede-san #+# #+# */
|
||||
/* Updated: 2026/02/14 01:32:42 by sede-san ### ########.fr */
|
||||
/* Updated: 2026/02/14 13:30:34 by sede-san ### ########.fr */
|
||||
/* */
|
||||
/* ************************************************************************** */
|
||||
|
||||
@@ -59,19 +59,13 @@ void set_env(
|
||||
char *old_value;
|
||||
|
||||
environment = minishell->variables.environment;
|
||||
key = (char *)name;
|
||||
if (key != NULL && !ft_hashmap_contains_key(environment, key))
|
||||
if (name != NULL && !ft_hashmap_contains_key(environment, name))
|
||||
{
|
||||
key = ft_strdup(name);
|
||||
if (key == NULL)
|
||||
{
|
||||
minishell->exit = true;
|
||||
malloc_error();
|
||||
return ;
|
||||
}
|
||||
return (minishell->exit = true, malloc_error());
|
||||
}
|
||||
val = value;
|
||||
if (val == NULL)
|
||||
if (value == NULL)
|
||||
val = ft_strdup("");
|
||||
else
|
||||
val = ft_strdup(value);
|
||||
@@ -79,9 +73,7 @@ void set_env(
|
||||
{
|
||||
if (key != name)
|
||||
free(key);
|
||||
minishell->exit = true;
|
||||
malloc_error();
|
||||
return ;
|
||||
return (minishell->exit = true, malloc_error());
|
||||
}
|
||||
old_value = ft_hashmap_put(environment, key, val);
|
||||
if (old_value != NULL)
|
||||
|
||||
Reference in New Issue
Block a user