]> git.saurik.com Git - apple/libc.git/blame - gen/FreeBSD/scandir.c.patch
Libc-763.11.tar.gz
[apple/libc.git] / gen / FreeBSD / scandir.c.patch
CommitLineData
1f2f436a
A
1--- scandir.c.orig 2009-11-07 14:51:38.000000000 -0800
2+++ scandir.c 2009-11-07 14:51:40.000000000 -0800
3@@ -47,15 +47,11 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sca
34e8f829
A
4 #include "un-namespace.h"
5
6 /*
7- * The DIRSIZ macro is the minimum record length which will hold the directory
8+ * The _GENERIC_DIRSIZ macro is the minimum record length which will hold the directory
9 * entry. This requires the amount of space in struct dirent without the
10 * d_name field, plus enough space for the name and a terminating nul byte
11 * (dp->d_namlen + 1), rounded up to a 4 byte boundary.
12 */
13-#undef DIRSIZ
14-#define DIRSIZ(dp) \
15- ((sizeof(struct dirent) - sizeof(dp)->d_name) + \
16- (((dp)->d_namlen + 1 + 3) &~ 3))
17
18 int
19 scandir(dirname, namelist, select, dcomp)
1f2f436a 20@@ -83,7 +79,7 @@ scandir(dirname, namelist, select, dcomp
34e8f829
A
21 /*
22 * Make a minimum size copy of the data
23 */
24- p = (struct dirent *)malloc(DIRSIZ(d));
25+ p = (struct dirent *)malloc(_GENERIC_DIRSIZ(d));
26 if (p == NULL)
27 goto fail;
28 p->d_fileno = d->d_fileno;