summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibC/dirent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'Userland/Libraries/LibC/dirent.cpp')
-rw-r--r--Userland/Libraries/LibC/dirent.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/Userland/Libraries/LibC/dirent.cpp b/Userland/Libraries/LibC/dirent.cpp
index 7475d22519..3447b9d370 100644
--- a/Userland/Libraries/LibC/dirent.cpp
+++ b/Userland/Libraries/LibC/dirent.cpp
@@ -26,6 +26,13 @@ DIR* opendir(const char* name)
int fd = open(name, O_RDONLY | O_DIRECTORY);
if (fd == -1)
return nullptr;
+ return fdopendir(fd);
+}
+
+DIR* fdopendir(int fd)
+{
+ if (fd == -1)
+ return nullptr;
DIR* dirp = (DIR*)malloc(sizeof(DIR));
dirp->fd = fd;
dirp->buffer = nullptr;