From: Rich Felker Date: Thu, 8 Jun 2017 23:50:23 +0000 (-0400) Subject: fix glob failure to match plain "/" to root directory X-Git-Url: http://nsz.repo.hu/git/?a=commitdiff_plain;h=84eff797e3e38210cc311b000b1586b948b4fc35;p=musl fix glob failure to match plain "/" to root directory the check to prevent matching empty string wrongly blocked matching of "/" due to checking emptiness after stripping leading slashes rather than checking the full original argument string. simplified from patch by Julien Ramseier. --- diff --git a/src/regex/glob.c b/src/regex/glob.c index 5b6ff124..2d4d562e 100644 --- a/src/regex/glob.c +++ b/src/regex/glob.c @@ -179,7 +179,7 @@ int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, i if (strnlen(p, PATH_MAX+1) > PATH_MAX) return GLOB_NOSPACE; - if (*p) error = match_in_dir(d, p, flags, errfunc, &tail); + if (*pat) error = match_in_dir(d, p, flags, errfunc, &tail); if (error == GLOB_NOSPACE) { freelist(&head); return error;