mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-23 13:05:12 +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
Notes:
sideshowbarker
2024-07-19 09:42:28 +09:00
Author: https://github.com/Quaker762 Commit: https://github.com/SerenityOS/serenity/commit/dfaa5ecf81f Pull-request: https://github.com/SerenityOS/serenity/pull/1059 Reviewed-by: https://github.com/awesomekling Reviewed-by: https://github.com/bugaevc
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;
|
||||
else if (!strcmp(mode, "w+") || !strcmp(mode, "wb+"))
|
||||
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 {
|
||||
fprintf(stderr, "FIXME(LibC): fopen('%s', '%s')\n", pathname, mode);
|
||||
ASSERT_NOT_REACHED();
|
||||
|
|
Loading…
Add table
Reference in a new issue