diff options
author | Rich Felker <dalias@aerifal.cx> | 2023-08-24 12:54:51 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2023-08-24 12:54:51 -0400 |
commit | 79bdacff83a6bd5b70ff5ae5eb8b6de82c2f7c30 (patch) | |
tree | 521b95b20cb0b110562dc1738c7fc241686ea243 /src | |
parent | 7291c6c66a8d033bb487e6d8c8b003c8a7b6a550 (diff) | |
download | musl-79bdacff83a6bd5b70ff5ae5eb8b6de82c2f7c30.tar.gz |
glob: fix wrong return code when aborting before any matches
when the result count was zero, glob was ignoring a possible
GLOB_ABORTED error code and returning GLOB_NOMATCH. whether this
happened could be nondeterministic and dependent on the order of
dirent enumeration, in cases where multiple matches were present and
only some produced errors.
caught by Tor's test_util_glob.
Diffstat (limited to 'src')
-rw-r--r-- | src/regex/glob.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/regex/glob.c b/src/regex/glob.c index a4906446..87bae084 100644 --- a/src/regex/glob.c +++ b/src/regex/glob.c @@ -265,7 +265,7 @@ int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, i if (append(&tail, pat, strlen(pat), 0)) return GLOB_NOSPACE; cnt++; - } else + } else if (!error) return GLOB_NOMATCH; } |