forked from Imagelibrary/rtems
msdos: Fix file truncated to 0
Previously the first cluster of the file was not updated when truncating to 0 but was in any case freed. Now the first cluster of the file is updated during the truncation, leaving the directory entry in a consistent state. Closes #2757
This commit is contained in:
committed by
Gedare Bloom
parent
73918bc788
commit
606584d032
@@ -862,6 +862,13 @@ fat_file_truncate(
|
||||
fat_fd->map.disk_cln = new_last_cln;
|
||||
fat_fd->map.last_cln = new_last_cln;
|
||||
}
|
||||
else
|
||||
{
|
||||
fat_file_set_first_cluster_num(fat_fd, FAT_GENFAT_FREE);
|
||||
fat_fd->map.file_cln = FAT_UNDEFINED_VALUE;
|
||||
fat_fd->map.disk_cln = FAT_UNDEFINED_VALUE;
|
||||
fat_fd->map.last_cln = FAT_UNDEFINED_VALUE;
|
||||
}
|
||||
return RC_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user