mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 00:47:45 +00:00
Fix wrong allocation size used in opendir().
This commit is contained in:
parent
2fdc7c2c60
commit
69c7a59e6f
1 changed files with 6 additions and 5 deletions
|
@ -1,8 +1,9 @@
|
||||||
#include "dirent.h"
|
#include <dirent.h>
|
||||||
#include "unistd.h"
|
#include <unistd.h>
|
||||||
#include "stdlib.h"
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
#include <Kernel/Syscall.h>
|
#include <Kernel/Syscall.h>
|
||||||
#include "stdio.h"
|
|
||||||
|
|
||||||
extern "C" {
|
extern "C" {
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ DIR* opendir(const char* name)
|
||||||
int fd = open(name, O_RDONLY | O_DIRECTORY);
|
int fd = open(name, O_RDONLY | O_DIRECTORY);
|
||||||
if (fd == -1)
|
if (fd == -1)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
DIR* dirp = (DIR*)malloc(sizeof(dirp));
|
DIR* dirp = (DIR*)malloc(sizeof(DIR));
|
||||||
dirp->fd = fd;
|
dirp->fd = fd;
|
||||||
dirp->buffer = nullptr;
|
dirp->buffer = nullptr;
|
||||||
dirp->buffer_size = 0;
|
dirp->buffer_size = 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue