summaryrefslogtreecommitdiffstats
path: root/src/s_lcom.c
diff options
context:
space:
mode:
authorJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 22:14:06 +0200
committerJozanLeClerc <bousset.rudy@gmail.com>2020-07-30 22:14:06 +0200
commitdb381c5a5d8755937663a5ea61e655186f7606e7 (patch)
treee0cd8079eda191e838e994e8f31a83f838b6bf79 /src/s_lcom.c
parentDouble exit no more (diff)
download42-minishell-db381c5a5d8755937663a5ea61e655186f7606e7.tar.gz
42-minishell-db381c5a5d8755937663a5ea61e655186f7606e7.tar.bz2
42-minishell-db381c5a5d8755937663a5ea61e655186f7606e7.tar.xz
42-minishell-db381c5a5d8755937663a5ea61e655186f7606e7.tar.zst
42-minishell-db381c5a5d8755937663a5ea61e655186f7606e7.zip
Not too bad
Diffstat (limited to 'src/s_lcom.c')
-rw-r--r--src/s_lcom.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/s_lcom.c b/src/s_lcom.c
index 31b14d6..773814f 100644
--- a/src/s_lcom.c
+++ b/src/s_lcom.c
@@ -49,11 +49,8 @@ static int8_t
j = 0;
while (i > 0 && j < i)
{
- if (!((*lcom)->argv[j] =
- (char*)malloc((ft_strlen(words[j]) + 1) * sizeof(char))))
+ if (!((*lcom)->argv[j] = ft_strdup(words[j])))
return (-1);
- ft_strlcpy((*lcom)->argv[j], words[j],
- ft_strlen(words[j]) + 1);
j++;
}
(*lcom)->argv[j] = 0;
@@ -134,6 +131,7 @@ t_lcom
return (NULL);
if (!(words = subst_vars(words, msh)))
return (NULL);
+ words = p_check_first_arg_equals(words);
if (fill_lcom(words, &link) < 0)
{
ft_delwords(words);