.. in subdir of root always links to cluster 0

This commit is contained in:
Dave Murphy 2009-06-09 18:22:51 +00:00
parent 76a9624d2e
commit eafce2e122

View File

@ -427,6 +427,11 @@ int _FAT_mkdir_r (struct _reent *r, const char *path, int mode) {
// Create the double dot entry within the directory // Create the double dot entry within the directory
// if ParentDir == Rootdir then ".."" always link to Cluster 0
if(parentCluster == partition->rootDirCluster)
parentCluster = FAT16_ROOT_DIR_CLUSTER;
newEntryData[DIR_ENTRY_name + 1] = '.'; newEntryData[DIR_ENTRY_name + 1] = '.';
u16_to_u8array (newEntryData, DIR_ENTRY_cluster, parentCluster); u16_to_u8array (newEntryData, DIR_ENTRY_cluster, parentCluster);
u16_to_u8array (newEntryData, DIR_ENTRY_clusterHigh, parentCluster >> 16); u16_to_u8array (newEntryData, DIR_ENTRY_clusterHigh, parentCluster >> 16);