From 57af0d70d3b90b4a0a89f7d2b96ed53c1bb7bb03 Mon Sep 17 00:00:00 2001 From: nineisk Date: Thu, 26 Jan 2017 09:30:12 +0700 Subject: [PATCH] =?utf8?q?Fix=20fopen()=20in=20=E2=80=9Ca=E2=80=9D=20(appe?= =?utf8?q?nd)=20mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit fopen() does not work when file is opened in “a” (append) mode --- components/fatfs/src/vfs_fat.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/fatfs/src/vfs_fat.c b/components/fatfs/src/vfs_fat.c index 4ef387b43b..73bed5eaa1 100644 --- a/components/fatfs/src/vfs_fat.c +++ b/components/fatfs/src/vfs_fat.c @@ -152,7 +152,7 @@ static int fat_mode_conv(int m) } if ((m & O_CREAT) && (m & O_EXCL)) { res |= FA_CREATE_NEW; - } else if (m & O_CREAT) { + } else if ((m & O_CREAT) && (m & O_TRUNC)) { res |= FA_CREATE_ALWAYS; } else if (m & O_APPEND) { res |= FA_OPEN_ALWAYS; -- 2.40.0