diff options
Diffstat (limited to 'Src/glob.c')
-rw-r--r-- | Src/glob.c | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/Src/glob.c b/Src/glob.c index 05bfbbafb..c457e97ac 100644 --- a/Src/glob.c +++ b/Src/glob.c @@ -2327,16 +2327,22 @@ mod_export void remnulargs(char *s) { if (*s) { - char *t = s, *p = s, c; + char *o = s, c; while ((c = *s++)) - if (!INULL(c)) - *p++ = c; - *p = '\0'; - if (!*t) { - t[0] = Nularg; - t[1] = '\0'; - } + if (INULL(c)) { + char *t = s - 1; + + while ((c = *s++)) + if (!INULL(c)) + *t++ = c; + *t = '\0'; + if (!*o) { + o[0] = Nularg; + o[1] = '\0'; + } + break; + } } } |