diff options
author | Rich Felker <dalias@aerifal.cx> | 2019-07-11 16:55:17 -0400 |
---|---|---|
committer | Rich Felker <dalias@aerifal.cx> | 2019-08-07 02:38:45 -0400 |
commit | e408deefeb1a60b6e9e1bb63393590926f96ee64 (patch) | |
tree | 96116a6faec49580bc3cd200ed08e15be7f66b65 /src/select/select.c | |
parent | d493206de7df4db07ad34f24701539ba0a6ed38c (diff) | |
download | musl-e408deefeb1a60b6e9e1bb63393590926f96ee64.tar.gz musl-e408deefeb1a60b6e9e1bb63393590926f96ee64.tar.bz2 musl-e408deefeb1a60b6e9e1bb63393590926f96ee64.tar.xz musl-e408deefeb1a60b6e9e1bb63393590926f96ee64.zip |
fix failure of glob to match broken symlinks under some conditions
when the pattern ended with one or more literal path components, or
when the GLOB_MARK flag was passed to request that glob flag directory
results and the type obtained by readdir was unknown or inconclusive
(symlink), the stat function was called to evaluate existence and/or
determine type. however, stat fails with ENOENT for broken symlinks,
and this caused the match to be omitted from the results.
instead, use stat only for the unknown/inconclusive cases with
GLOB_MARK, and otherwise, or if stat fails, use lstat existence still
needs to be determined. this minimizes the number of costly syscalls,
performing both only in the case where GLOB_MARK is in use and there
is a final literal path component which is a broken symlink.
based on/simplified from patch by James Y Knight.
Diffstat (limited to 'src/select/select.c')
0 files changed, 0 insertions, 0 deletions