summaryrefslogtreecommitdiffstats
path: root/src/b_unset.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-08-04 14:28:35 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-08-04 14:28:35 +0200
commitd1ee0c0e55f75432da026f5e0e7cf15cee6918da (patch)
treef0ba3ebf5f6ba8d2ce093938f36602d64e7b43ff /src/b_unset.c
parentUnset is fine (diff)
download42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.gz
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.bz2
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.xz
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.tar.zst
42-minishell-d1ee0c0e55f75432da026f5e0e7cf15cee6918da.zip
New libft function strclen, bug fix
Diffstat (limited to 'src/b_unset.c')
-rw-r--r--src/b_unset.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/b_unset.c b/src/b_unset.c
index 598db92..03fd2a8 100644
--- a/src/b_unset.c
+++ b/src/b_unset.c
@@ -65,6 +65,8 @@ static void
if (i == skip)
{
i += 1;
+ if (msh->envp[i] == NULL)
+ break ;
skipped = 1;
}
if (!(nenvp[i - skipped] = ft_strdup(msh->envp[i])))
@@ -85,7 +87,7 @@ static t_bool
i = 0;
while (msh->envp[i] != NULL)
{
- if (ft_strncmp(arg, msh->envp[i], ft_strlen(arg)) == 0)
+ if (ft_strncmp(arg, msh->envp[i], ft_strclen(msh->envp[i], '=')) == 0)
{
b_realloc_env(i, msh);
return (TRUE);