From eafce2e1225ed10868a8dad77f4f02fab9ee56a3 Mon Sep 17 00:00:00 2001 From: Dave Murphy Date: Tue, 9 Jun 2009 18:22:51 +0000 Subject: [PATCH] .. in subdir of root always links to cluster 0 --- source/fatdir.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/fatdir.c b/source/fatdir.c index df83698..55faa0b 100644 --- a/source/fatdir.c +++ b/source/fatdir.c @@ -427,6 +427,11 @@ int _FAT_mkdir_r (struct _reent *r, const char *path, int mode) { // 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] = '.'; u16_to_u8array (newEntryData, DIR_ENTRY_cluster, parentCluster); u16_to_u8array (newEntryData, DIR_ENTRY_clusterHigh, parentCluster >> 16);