libc: Use fdopen() after calling open() in fopen()
This commit is contained in:
parent
494b48bbe3
commit
e17a21dbad
@ -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*)
|
||||
|
Loading…
Reference in New Issue
Block a user