fix(fatfs): preserve access mode in VFS F_SETFL

F_SETFL was replacing the whole flags word, so fcntl(fd, F_SETFL, O_APPEND)
made F_GETFL report O_RDONLY|O_APPEND. Keep O_ACCMODE and apply only POSIX
status flags.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Martin Vychodil
2026-08-20 15:51:42 +02:00
co-authored by Cursor
parent e24f64d20d
commit 5fc9a1ea04
4 changed files with 47 additions and 2 deletions
@@ -195,6 +195,13 @@ TEST_CASE("(WL) overwrite and append file", "[fatfs][wear_levelling]")
test_teardown();
}
TEST_CASE("(WL) fcntl F_SETFL preserves access mode", "[fatfs][wear_levelling]")
{
test_setup();
test_fatfs_fcntl_setfl("/spiflash/fcntl.txt");
test_teardown();
}
TEST_CASE("(WL) can lseek", "[fatfs][wear_levelling]")
{
test_setup();