rework langinfo code for ABI compat and for use by time code
[musl] / src / misc / wordexp.c
index 34fc900..617706e 100644 (file)
@@ -139,11 +139,15 @@ static int do_wordexp(const char *s, wordexp_t *we, int flags)
 
        we->we_wordv = wv;
        we->we_wordc = i;
+
+       for (i=we->we_offs; i; i--)
+               we->we_wordv[i-1] = 0;
+
        if (flags & WRDE_DOOFFS) we->we_wordc -= we->we_offs;
        return err;
 }
 
-int wordexp(const char *s, wordexp_t *we, int flags)
+int wordexp(const char *restrict s, wordexp_t *restrict we, int flags)
 {
        int r, cs;
        pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, &cs);