bugfix: fix for fatfs "open("xx",O_CREAT|O_WRONLY,0666)" call failure

fatfs 'open' with only O_CREAT flag fails to creat new file

Closes https://github.com/espressif/esp-idf/issues/1817
This commit is contained in:
Sonika Rathi
2023-04-03 14:55:37 +05:30
parent 9cfc9757b9
commit b31b68fc68
4 changed files with 37 additions and 1 deletions

View File

@@ -264,7 +264,7 @@ static int fat_mode_conv(int m)
res |= FA_CREATE_NEW;
} else if ((m & O_CREAT) && (m & O_TRUNC)) {
res |= FA_CREATE_ALWAYS;
} else if (m & O_APPEND) {
} else if ((m & O_APPEND) || (m & O_CREAT)) {
res |= FA_OPEN_ALWAYS;
} else {
res |= FA_OPEN_EXISTING;