From: nineisk Date: Thu, 26 Jan 2017 02:30:12 +0000 (+0700) Subject: Fix fopen() in “a” (append) mode X-Git-Tag: v2.0-rc2~47^2~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=57af0d70d3b90b4a0a89f7d2b96ed53c1bb7bb03;p=esp-idf Fix fopen() in “a” (append) mode fopen() does not work when file is opened in “a” (append) mode --- 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;