summaryrefslogtreecommitdiff
path: root/libc/misc/dirent/opendir.c
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2002-05-11 00:26:15 +0000
committerEric Andersen <andersen@codepoet.org>2002-05-11 00:26:15 +0000
commita4f07581502ee212aa45e7b0049fdd126dd10b40 (patch)
tree935a2f668e5fb5306e0e12f380924d2311da5ee5 /libc/misc/dirent/opendir.c
parentd2be3a1d010ea7e953d15a2e705373735723c06e (diff)
Implement readdir_r. Audit for proper thread safety and locking.
-Erik
Diffstat (limited to 'libc/misc/dirent/opendir.c')
-rw-r--r--libc/misc/dirent/opendir.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/misc/dirent/opendir.c b/libc/misc/dirent/opendir.c
index e2a6000ca..48911ce32 100644
--- a/libc/misc/dirent/opendir.c
+++ b/libc/misc/dirent/opendir.c
@@ -39,7 +39,6 @@ DIR *opendir(const char *name)
ptr->dd_fd = fd;
ptr->dd_nextloc = ptr->dd_size = ptr->dd_nextoff = 0;
- ptr->dd_getdents = unknown;
ptr->dd_max = statbuf.st_blksize;
if (ptr->dd_max < 512)
@@ -52,5 +51,8 @@ DIR *opendir(const char *name)
return NULL;
}
ptr->dd_buf = buf;
+#ifdef _POSIX_THREADS
+ pthread_mutex_init(ptr->dd_lock, NULL);
+#endif
return ptr;
}