cvs commit: src/lib/libc/gen scandir.c
David Schultz
das at FreeBSD.org
Sun Mar 16 12:08:54 PDT 2008
das 2008-03-16 19:08:53 UTC
FreeBSD src repository
Modified files:
lib/libc/gen scandir.c
Log:
scandir(3) previously used st_size to obtain an initial estimate
of the array length needed to store all the directory entries.
Although BSD has historically guaranteed that st_size is the size
of the directory file, POSIX does not, and more to the point, some
recent filesystems such as ZFS use st_size to mean something else.
The fix is to not stat the directory at all, set the initial
array size to 32 entries, and realloc it in powers of 2 if that
proves insufficient.
PR: 113668
Revision Changes Path
1.9 +3 -13 src/lib/libc/gen/scandir.c
More information about the cvs-src
mailing list