mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 18:09:17 +01:00
Fixed problem that got wrong fstat when creating a new file at the end of a directory
This commit is contained in:
parent
eb2b6d1e20
commit
9077692f45
@ -589,12 +589,14 @@ static bool _FAT_directory_findEntryGap (PARTITION* partition, DIR_ENTRY* entry,
|
|||||||
|
|
||||||
if (endOfDirectory) {
|
if (endOfDirectory) {
|
||||||
memset (entryData, DIR_ENTRY_LAST, DIR_ENTRY_DATA_SIZE);
|
memset (entryData, DIR_ENTRY_LAST, DIR_ENTRY_DATA_SIZE);
|
||||||
while (((dirEntryRemain + 1) > 0) && entryStillValid) {
|
dirEntryRemain += 1; // Increase by one to take account of End Of Directory Marker
|
||||||
|
while ((dirEntryRemain > 0) && entryStillValid) {
|
||||||
|
// Get the gapEnd before incrementing it, so the second to last one is saved
|
||||||
|
entry->dataEnd = gapEnd;
|
||||||
|
// Increment gapEnd, moving onto the next entry
|
||||||
entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &gapEnd, true);
|
entryStillValid = _FAT_directory_incrementDirEntryPosition (partition, &gapEnd, true);
|
||||||
-- dirEntryRemain;
|
-- dirEntryRemain;
|
||||||
if (dirEntryRemain > 0) {
|
// Fill the entry with blanks
|
||||||
entry->dataEnd = gapEnd;
|
|
||||||
}
|
|
||||||
_FAT_cache_writePartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, gapEnd.cluster) + gapEnd.sector, gapEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
|
_FAT_cache_writePartialSector (partition->cache, entryData, _FAT_fat_clusterToSector(partition, gapEnd.cluster) + gapEnd.sector, gapEnd.offset * DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
|
||||||
}
|
}
|
||||||
if (!entryStillValid) {
|
if (!entryStillValid) {
|
||||||
|
Loading…
Reference in New Issue
Block a user