mirror of
https://github.com/wiiu-env/libfat.git
synced 2024-11-22 01:49:17 +01:00
Now clears the whole cluster when creating or extending a directory, bug found by Hermes
This commit is contained in:
parent
dbdb8900b5
commit
8956d40bc1
@ -34,6 +34,9 @@
|
||||
|
||||
2006-08-19 - Chishm
|
||||
* Fixed entryFromPath bug when looking for "." in root directory
|
||||
|
||||
2006-10-01 - Chishm
|
||||
* Now clears the whole new cluster when linking in more clusters for a directory
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -201,7 +204,7 @@ static bool _FAT_directory_incrementDirEntryPosition (PARTITION* partition, DIR_
|
||||
tempCluster = _FAT_fat_nextCluster(partition, position.cluster);
|
||||
if (tempCluster == CLUSTER_EOF) {
|
||||
if (extendDirectory) {
|
||||
tempCluster = _FAT_fat_linkFreeCluster (partition, position.cluster);
|
||||
tempCluster = _FAT_fat_linkFreeClusterCleared (partition, position.cluster);
|
||||
if (tempCluster == CLUSTER_FREE) {
|
||||
return false; // This will only happen if the disc is full
|
||||
}
|
||||
|
@ -36,6 +36,9 @@
|
||||
|
||||
2006-08-19 - Chishm
|
||||
* Updated dirnext return values to return correctly
|
||||
|
||||
2006-10-01 - Chishm
|
||||
* Now clears the whole cluster when creating a new directory, bug found by Hermes
|
||||
*/
|
||||
|
||||
#include <string.h>
|
||||
@ -382,7 +385,7 @@ int _FAT_mkdir_r (struct _reent *r, const char *path, int mode) {
|
||||
dirEntry.entryData[DIR_ENTRY_attributes] = ATTRIB_DIR;
|
||||
|
||||
// Get a cluster for the new directory
|
||||
dirCluster = _FAT_fat_linkFreeCluster (partition, CLUSTER_FREE);
|
||||
dirCluster = _FAT_fat_linkFreeClusterCleared (partition, CLUSTER_FREE);
|
||||
if (dirCluster == CLUSTER_FREE) {
|
||||
// No space left on disc for the cluster
|
||||
r->_errno = ENOSPC;
|
||||
@ -419,7 +422,6 @@ int _FAT_mkdir_r (struct _reent *r, const char *path, int mode) {
|
||||
_FAT_cache_writePartialSector ( partition->cache, newEntryData,
|
||||
_FAT_fat_clusterToSector (partition, dirCluster), DIR_ENTRY_DATA_SIZE, DIR_ENTRY_DATA_SIZE);
|
||||
|
||||
|
||||
// Flush any sectors in the disc cache
|
||||
if (!_FAT_cache_flush(partition->cache)) {
|
||||
r->_errno = EIO;
|
||||
|
Loading…
Reference in New Issue
Block a user