forked from len0rd/rockbox
Second bug in mkdir() :-)
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4241 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
d815ad6035
commit
54353e04b1
2 changed files with 7 additions and 1 deletions
|
|
@ -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));
|
rc = fat_create_dir(basename, &newdir, &(dir->fatdir));
|
||||||
|
|
||||||
|
closedir(dir);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1340,6 +1340,7 @@ int fat_create_dir(char* name,
|
||||||
LDEBUGF("fat_create_dir(\"%s\",%x,%x)\n",name,newdir,dir);
|
LDEBUGF("fat_create_dir(\"%s\",%x,%x)\n",name,newdir,dir);
|
||||||
|
|
||||||
memset(newdir, sizeof(struct fat_dir), 0);
|
memset(newdir, sizeof(struct fat_dir), 0);
|
||||||
|
memset(&dummyfile, sizeof(struct fat_file), 0);
|
||||||
|
|
||||||
/* First, add the entry in the parent directory */
|
/* First, add the entry in the parent directory */
|
||||||
rc = add_dir_entry(dir, &newdir->file, name, true, false);
|
rc = add_dir_entry(dir, &newdir->file, name, true, false);
|
||||||
|
|
@ -1347,6 +1348,9 @@ int fat_create_dir(char* name,
|
||||||
return rc * 10 - 1;
|
return rc * 10 - 1;
|
||||||
|
|
||||||
/* Then add the "." entry */
|
/* 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);
|
rc = add_dir_entry(newdir, &dummyfile, ".", true, true);
|
||||||
if (rc < 0)
|
if (rc < 0)
|
||||||
return rc * 10 - 2;
|
return rc * 10 - 2;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue