summaryrefslogtreecommitdiff
path: root/lib/libc/gen/opendir.c
diff options
context:
space:
mode:
authorDaniel Eischen <deischen@FreeBSD.org>2000-12-11 04:00:36 +0000
committerDaniel Eischen <deischen@FreeBSD.org>2000-12-11 04:00:36 +0000
commit10d1cba0bf09c9bdbdc2ac7ff62b9516de75db4c (patch)
treea2c27d82905b580cc8144c6b67c1173c2399fc0a /lib/libc/gen/opendir.c
parent3d48aa2a7cfbcc2d87e60e86e63d0bbce8d0ace6 (diff)
Notes
Diffstat (limited to 'lib/libc/gen/opendir.c')
-rw-r--r--lib/libc/gen/opendir.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/libc/gen/opendir.c b/lib/libc/gen/opendir.c
index 90aaec32e196..bd7fc82ab0b7 100644
--- a/lib/libc/gen/opendir.c
+++ b/lib/libc/gen/opendir.c
@@ -47,6 +47,8 @@ static char sccsid[] = "@(#)opendir.c 8.8 (Berkeley) 5/1/95";
#include <stdlib.h>
#include <unistd.h>
+#include "telldir.h"
+
/*
* Open a directory.
*/
@@ -90,9 +92,13 @@ __opendir2(name, flags)
goto fail;
}
if (_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
- (dirp = malloc(sizeof(DIR))) == NULL)
+ (dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL)
goto fail;
+ dirp->dd_td = (void *)dirp + sizeof(DIR);
+ LIST_INIT(&dirp->dd_td->td_locq);
+ dirp->dd_td->td_loccnt = 0;
+
/*
* Use the system page size if that is a multiple of DIRBLKSIZ.
* Hopefully this can be a big win someday by allowing page
@@ -259,8 +265,6 @@ __opendir2(name, flags)
dirp->dd_loc = 0;
dirp->dd_fd = fd;
dirp->dd_flags = flags;
- dirp->dd_loccnt = 0;
- LIST_INIT(&dirp->dd_locq);
/*
* Set up seek point for rewinddir.