]> git.saurik.com Git - apple/libc.git/blob - gen/FreeBSD/scandir.c.patch
Libc-594.9.4.tar.gz
[apple/libc.git] / gen / FreeBSD / scandir.c.patch
1 --- scandir.c.orig 2008-07-28 02:49:02.000000000 -0700
2 +++ scandir.c 2008-07-29 12:02:49.000000000 -0700
3 @@ -53,15 +53,11 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/sca
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)
20 @@ -96,7 +92,7 @@ scandir(dirname, namelist, select, dcomp
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;