mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 15:07:45 +00:00
LibC: Implement append modes for fopen()
Previously, `fopen()` didn't contain an implementation for the append modes, even though the Kernel supports it via `O_APPEND`. This patch rectifies that by implementing them so an assert is no longer thrown.
This commit is contained in:
parent
cdbdd397db
commit
dfaa5ecf81
1 changed files with 4 additions and 0 deletions
|
@ -498,6 +498,10 @@ FILE* fopen(const char* pathname, const char* mode)
|
||||||
flags = O_WRONLY | O_CREAT | O_TRUNC;
|
flags = O_WRONLY | O_CREAT | O_TRUNC;
|
||||||
else if (!strcmp(mode, "w+") || !strcmp(mode, "wb+"))
|
else if (!strcmp(mode, "w+") || !strcmp(mode, "wb+"))
|
||||||
flags = O_RDWR | O_CREAT | O_TRUNC;
|
flags = O_RDWR | O_CREAT | O_TRUNC;
|
||||||
|
else if (!strcmp(mode, "a") || !strcmp(mode, "ab"))
|
||||||
|
flags = O_WRONLY | O_APPEND | O_CREAT;
|
||||||
|
else if (!strcmp(mode, "a+") || !strcmp(mode, "ab+"))
|
||||||
|
flags = O_RDWR | O_APPEND | O_CREAT;
|
||||||
else {
|
else {
|
||||||
fprintf(stderr, "FIXME(LibC): fopen('%s', '%s')\n", pathname, mode);
|
fprintf(stderr, "FIXME(LibC): fopen('%s', '%s')\n", pathname, mode);
|
||||||
ASSERT_NOT_REACHED();
|
ASSERT_NOT_REACHED();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue