Date: Tue, 6 May 2008 05:45:59 +0000 (UTC) From: David Schultz <das@FreeBSD.org> To: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: cvs commit: src/lib/libc/gen scandir.c Message-ID: <200805060545.m465jx4O013993@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
das 2008-05-06 05:45:58 UTC
FreeBSD src repository
Modified files: (Branch: RELENG_7)
lib/libc/gen scandir.c
Log:
MFC scandir.c,v 1.9
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.8.2.1 +3 -13 src/lib/libc/gen/scandir.c
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200805060545.m465jx4O013993>
