Fix FAT driver file modes, update filewriter accordingly
Some checks failed
Build documentation / build-and-deploy (push) Has been cancelled

This commit is contained in:
2026-03-15 20:18:50 +01:00
parent d7bfc5c8fd
commit af966b5405
5 changed files with 30 additions and 20 deletions

View File

@@ -227,10 +227,11 @@ DEFINE_VFS_WRITE_FILE (fatfs_write_file) {
FL_FILE* file;
if ((flags & WF_APPEND))
if ((flags & WF_TRUNCATE) && off == 0) {
file = fl_fopen (fatfs_ctx, path, "wb+");
} else {
file = fl_fopen (fatfs_ctx, path, "rb+");
else
file = fl_fopen (fatfs_ctx, path, "wb");
}
if (file == NULL)
return -ST_NOT_FOUND;
@@ -276,7 +277,7 @@ DEFINE_VFS_CREATE_FILE (fatfs_create_file) {
fatfs_ctx->proc = proc;
fatfs_ctx->rctx = rctx;
FL_FILE* file = fl_fopen (fatfs_ctx, path, "wb+");
FL_FILE* file = fl_fopen (fatfs_ctx, path, "ab+");
if (file == NULL)
return -ST_NOT_FOUND;