diff --git a/libs/libc/src/file.cpp b/libs/libc/src/file.cpp index 60e5ac45..0ef00616 100644 --- a/libs/libc/src/file.cpp +++ b/libs/libc/src/file.cpp @@ -30,14 +30,11 @@ extern "C" return 0; // FIXME: Implement buffered IO. } - FILE* fopen(const char* pathname, const char*) + FILE* fopen(const char* pathname, const char* mode) { int fd = open(pathname, O_RDWR); // FIXME: Use the mode string. if (fd < 0) { return 0; } - FILE* stream = (FILE*)malloc(sizeof(FILE)); - stream->f_fd = fd; - clearerr(stream); - return stream; + return fdopen(fd, mode); } FILE* fdopen(int fd, const char*)