From 00989fb49003f0ccbb2d2f33346c0f448b4cdbd5 Mon Sep 17 00:00:00 2001 From: william Date: Thu, 9 Mar 2017 17:53:02 +0100 Subject: [PATCH] rectif de gen_tab pour copier les esc --- 42sh/src/glob/gen_tab_esc.c | 4 ++-- 42sh/src/glob/is_char_esc.c | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/42sh/src/glob/gen_tab_esc.c b/42sh/src/glob/gen_tab_esc.c index 39c8e342..04136888 100644 --- a/42sh/src/glob/gen_tab_esc.c +++ b/42sh/src/glob/gen_tab_esc.c @@ -26,9 +26,9 @@ char **gen_tab(const char *pat, { len = ft_strlen(pat); my_tab[0] = ft_strdup(pat); - my_tab[1] = (char *)dup_char_esc(esc, len >> 3); + my_tab[1] = (char *)dup_char_esc(esc, (len >> 3) + 1); if (esc2) - my_tab[2] = (char *)dup_char_esc(esc2, len >> 3); + my_tab[2] = (char *)dup_char_esc(esc2, (len >> 3) + 1); } else { diff --git a/42sh/src/glob/is_char_esc.c b/42sh/src/glob/is_char_esc.c index 0f83bff6..cfb99d30 100644 --- a/42sh/src/glob/is_char_esc.c +++ b/42sh/src/glob/is_char_esc.c @@ -66,6 +66,7 @@ unsigned char *dup_char_esc(const unsigned char *esc, const int size) if (!(new_esc = (unsigned char *)ft_strnew(size))) return (NULL); - ft_memcpy(new_esc, esc, size); + new_esc = ft_memcpy(new_esc, esc, size); + return (new_esc); }