summaryrefslogtreecommitdiff
path: root/lib/libc/dirent/opendir.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/libc/dirent/opendir.c')
-rw-r--r--lib/libc/dirent/opendir.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/libc/dirent/opendir.c b/lib/libc/dirent/opendir.c
new file mode 100644
index 00000000..2e250024
--- /dev/null
+++ b/lib/libc/dirent/opendir.c
@@ -0,0 +1,15 @@
+#include <__dirent.h>
+
+#include <fcntl.h>
+#include <unistd.h>
+#include <dirent.h>
+
+DIR *opendir(const char *dirname)
+{
+ int fildes = open(dirname, O_RDONLY);
+
+ if (fildes < 0)
+ return NULL;
+
+ return fdopendir(fildes);
+}