summaryrefslogtreecommitdiff
path: root/src/regex/glob.c
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2017-06-08 19:50:23 -0400
committerRich Felker <dalias@aerifal.cx>2017-06-08 19:50:23 -0400
commit84eff797e3e38210cc311b000b1586b948b4fc35 (patch)
tree93d792eac55fb99cd0453617aaa340d177f90072 /src/regex/glob.c
parentbc313e880c6cde2e512d2f43e84968d1b12bd19d (diff)
downloadmusl-84eff797e3e38210cc311b000b1586b948b4fc35.tar.gz
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.
Diffstat (limited to 'src/regex/glob.c')
-rw-r--r--src/regex/glob.c2
1 files changed, 1 insertions, 1 deletions
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;