mirror of git://git.musl-libc.org/musl
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.
This commit is contained in:
parent
7291c6c66a
commit
79bdacff83
|
@ -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))
|
if (append(&tail, pat, strlen(pat), 0))
|
||||||
return GLOB_NOSPACE;
|
return GLOB_NOSPACE;
|
||||||
cnt++;
|
cnt++;
|
||||||
} else
|
} else if (!error)
|
||||||
return GLOB_NOMATCH;
|
return GLOB_NOMATCH;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue