mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-13 11:29:58 +03:00
Merge pull request #10739 from hexfet/sdcard_name_clash
Fix name clashes in FAT filesystem
This commit is contained in:
commit
f25642cc56
1 changed files with 11 additions and 1 deletions
|
@ -2615,8 +2615,18 @@ static void afatfs_createFileContinue(afatfsFile_t *file)
|
||||||
opState->phase = AFATFS_CREATEFILE_PHASE_FAILURE;
|
opState->phase = AFATFS_CREATEFILE_PHASE_FAILURE;
|
||||||
goto doMore;
|
goto doMore;
|
||||||
}
|
}
|
||||||
|
} else if (entry->attrib & FAT_FILE_ATTRIBUTE_VOLUME_ID) {
|
||||||
|
break;
|
||||||
} else if (strncmp(entry->filename, (char*) opState->filename, FAT_FILENAME_LENGTH) == 0) {
|
} else if (strncmp(entry->filename, (char*) opState->filename, FAT_FILENAME_LENGTH) == 0) {
|
||||||
// We found a file with this name!
|
// We found a file or directory with this name!
|
||||||
|
|
||||||
|
// Do not open file as dir or dir as file
|
||||||
|
if (((entry->attrib ^ file->attrib) & FAT_FILE_ATTRIBUTE_DIRECTORY) != 0) {
|
||||||
|
afatfs_findLast(&afatfs.currentDirectory);
|
||||||
|
opState->phase = AFATFS_CREATEFILE_PHASE_FAILURE;
|
||||||
|
goto doMore;
|
||||||
|
}
|
||||||
|
|
||||||
afatfs_fileLoadDirectoryEntry(file, entry);
|
afatfs_fileLoadDirectoryEntry(file, entry);
|
||||||
|
|
||||||
afatfs_findLast(&afatfs.currentDirectory);
|
afatfs_findLast(&afatfs.currentDirectory);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue