summaryrefslogtreecommitdiff
path: root/firmware/drivers/fat.c
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/drivers/fat.c')
-rw-r--r--firmware/drivers/fat.c4
1 files changed, 4 insertions, 0 deletions
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,
1340 LDEBUGF("fat_create_dir(\"%s\",%x,%x)\n",name,newdir,dir); 1340 LDEBUGF("fat_create_dir(\"%s\",%x,%x)\n",name,newdir,dir);
1341 1341
1342 memset(newdir, sizeof(struct fat_dir), 0); 1342 memset(newdir, sizeof(struct fat_dir), 0);
1343 memset(&dummyfile, sizeof(struct fat_file), 0);
1343 1344
1344 /* First, add the entry in the parent directory */ 1345 /* First, add the entry in the parent directory */
1345 rc = add_dir_entry(dir, &newdir->file, name, true, false); 1346 rc = add_dir_entry(dir, &newdir->file, name, true, false);
@@ -1347,6 +1348,9 @@ int fat_create_dir(char* name,
1347 return rc * 10 - 1; 1348 return rc * 10 - 1;
1348 1349
1349 /* Then add the "." entry */ 1350 /* Then add the "." entry */
1351 newdir->file.firstcluster = find_free_cluster(fat_bpb.fsinfo.nextfree);
1352 update_fat_entry(newdir->file.firstcluster, FAT_EOF_MARK);
1353
1350 rc = add_dir_entry(newdir, &dummyfile, ".", true, true); 1354 rc = add_dir_entry(newdir, &dummyfile, ".", true, true);
1351 if (rc < 0) 1355 if (rc < 0)
1352 return rc * 10 - 2; 1356 return rc * 10 - 2;