Closed dexterbg closed 2 years ago
If the file already exists, the first mkstemp() call fails as well:
OVMS# vfs append "x" /sd/dddd.967295
OVMS# test mkstemp /sd/dddd
tempfile 1: '/sd/dddd.967295' => fd=-1 error='No such file or directory'
tempfile 2: '/sd/dddd.967295' => fd=-1 error='No such file or directory'
I'm sorry we didn't notice this issue in time. Running a similar test case with CONFIG_FATFS_LFN_HEAP=y
set, I am not able to reproduce an error with IDF 4.4 or master
.
Two different files get created:
tempfile 1: '/spiflash/file.967295' => fd=3 error='-'
tempfile 2: '/spiflash/file.a67295' => fd=4 error='-'
This may have been related to stat
failing for the root directory of FAT filesystem in the past (https://github.com/espressif/esp-idf/issues/984) but that issue got fixed before this one was opened, so perhaps there was some other issue.
mkstemp() always creates the same suffix regardless of the file name and/or existence of the temp file.
Test code
Result