summaryrefslogtreecommitdiff
path: root/LibC
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2018-10-31 17:25:24 +0100
committerAndreas Kling <awesomekling@gmail.com>2018-10-31 17:25:24 +0100
commit69c7a59e6f5306d1b5231bb1e80bdb9f563ac9a6 (patch)
tree61b921b14a30b21b507467a557f2badbf1464c15 /LibC
parent2fdc7c2c6094f478f2a7d192f0794195a10a7f2c (diff)
downloadserenity-69c7a59e6f5306d1b5231bb1e80bdb9f563ac9a6.zip
Fix wrong allocation size used in opendir().
Diffstat (limited to 'LibC')
-rw-r--r--LibC/dirent.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/LibC/dirent.cpp b/LibC/dirent.cpp
index e1e914b1f0..07d50d01d4 100644
--- a/LibC/dirent.cpp
+++ b/LibC/dirent.cpp
@@ -1,8 +1,9 @@
-#include "dirent.h"
-#include "unistd.h"
-#include "stdlib.h"
+#include <dirent.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
#include <Kernel/Syscall.h>
-#include "stdio.h"
extern "C" {
@@ -11,7 +12,7 @@ DIR* opendir(const char* name)
int fd = open(name, O_RDONLY | O_DIRECTORY);
if (fd == -1)
return nullptr;
- DIR* dirp = (DIR*)malloc(sizeof(dirp));
+ DIR* dirp = (DIR*)malloc(sizeof(DIR));
dirp->fd = fd;
dirp->buffer = nullptr;
dirp->buffer_size = 0;