]> Savannah Git Hosting - gnulib.git/commit
glob: fix symlink and // issues; improve speed
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 23 Mar 2022 16:52:58 +0000 (09:52 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 23 Mar 2022 17:24:44 +0000 (10:24 -0700)
commit98f034a0c2ba8917c96f363de1a8d66244e411da
tree2a7026d030a910047901b7d8b5088ecc89a63283
parent1bde7566b7262ed40462f038d6ac4995397d0c4a
glob: fix symlink and // issues; improve speed

* lib/glob.c: Include fcntl.h.
(dirfd) [_LIBC]: New macro.
(GLOB_STAT64, GLOB_LSTAT64): Remove.  Replace all uses with ...
(GLOB_FSTATAT64): ... this new macro.
(glob_in_dir): Treat DT_LNK like DT_UNKNOWN.
Use directory-relative fstatat unless GLOB_ALTDIRFUNC, or dirfd fails.
Avoid duplicate strlen (directory).
Work even if directory is "/", without turning it into "//".
Use a scratch buffer instead of by-hand alloca stuff.
Use mempcpy and memcpy instead of stpcpy and strcpy.
* modules/glob (Depends-on): Add dirfd, fstatat.  Remove stat.
(License): Change from LGPLv2+ to GPL, since it depends on
fstatat.
ChangeLog
lib/glob.c
modules/glob