summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-01-15 15:56:19 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-01-15 15:56:19 +0000
commit54353e04b116bb78edc529e7bf6687a845923b65 (patch)
tree5c083d7c1ea4f0fa7d1805af02a9660fb15c1924
parentd815ad60355558eddbfc338c481aa83fdf0a1e43 (diff)
downloadrockbox-54353e04b116bb78edc529e7bf6687a845923b65.tar.gz
rockbox-54353e04b116bb78edc529e7bf6687a845923b65.zip
Second bug in mkdir() :-)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4241 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/dir.c4
-rw-r--r--firmware/drivers/fat.c4
2 files changed, 7 insertions, 1 deletions
diff --git a/firmware/common/dir.c b/firmware/common/dir.c
index 52659085b8..001508a552 100644
--- a/firmware/common/dir.c
+++ b/firmware/common/dir.c
@@ -163,9 +163,11 @@ int mkdir(char *name)
}
}
- closedir(dir);
+ memset(&newdir, sizeof(struct fat_dir), 0);
rc = fat_create_dir(basename, &newdir, &(dir->fatdir));
+ closedir(dir);
+
return rc;
}
diff --git a/firmware/drivers/fat.c b/firmware/drivers/fat.c
index 55e6fa30cf..0a9f524c73 100644
--- a/firmware/drivers/fat.c
+++ b/firmware/drivers/fat.c
@@ -1340,6 +1340,7 @@ int fat_create_dir(char* name,
LDEBUGF("fat_create_dir(\"%s\",%x,%x)\n",name,newdir,dir);
memset(newdir, sizeof(struct fat_dir), 0);
+ memset(&dummyfile, sizeof(struct fat_file), 0);
/* First, add the entry in the parent directory */
rc = add_dir_entry(dir, &newdir->file, name, true, false);
@@ -1347,6 +1348,9 @@ int fat_create_dir(char* name,
return rc * 10 - 1;
/* Then add the "." entry */
+ newdir->file.firstcluster = find_free_cluster(fat_bpb.fsinfo.nextfree);
+ update_fat_entry(newdir->file.firstcluster, FAT_EOF_MARK);
+
rc = add_dir_entry(newdir, &dummyfile, ".", true, true);
if (rc < 0)
return rc * 10 - 2;