dir_uncached: fix opendir_uncached to have opened directories keep enough information to update metadata; this is necessary because of the way rmdir_uncached is implemented

FS#11107: should be fixed now

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25203 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Amaury Pouly 2010-03-15 12:32:04 +00:00
parent 46565f594a
commit 42660535be

View file

@ -114,16 +114,20 @@ DIR_UNCACHED* opendir_uncached(const char* name)
} }
if ( (entry.attr & FAT_ATTR_DIRECTORY) && if ( (entry.attr & FAT_ATTR_DIRECTORY) &&
(!strcasecmp(part, entry.name)) ) { (!strcasecmp(part, entry.name)) ) {
/* in reality, the parent_dir parameter of fat_opendir is /* In reality, the parent_dir parameter of fat_opendir seems
* useless because it's sole purpose it to have a way to * useless because it's sole purpose it to have a way to
* update the file metadata, but here we are only reading * update the file metadata, but here we are only reading
* a directory so there's no need for that kind of stuff. * a directory so there's no need for that kind of stuff.
* Consequently, we can safely pass NULL of it because * However, the rmdir_uncached function uses a ugly hack to
* fat_opendir and fat_open are NULL-protected. */ * avoid opening a directory twice when deleting it and thus
* needs those information. That's why we pass pdir->fatdir both
* as the parent directory and the resulting one (this is safe,
* in doubt, check fat_open(dir) code) which will allow this kind of
* (ugly) things */
if ( fat_opendir(IF_MV2(volume,) if ( fat_opendir(IF_MV2(volume,)
&pdir->fatdir, &pdir->fatdir,
entry.firstcluster, entry.firstcluster,
NULL) < 0 ) { &pdir->fatdir) < 0 ) {
DEBUGF("Failed opening dir '%s' (%ld)\n", DEBUGF("Failed opening dir '%s' (%ld)\n",
part, entry.firstcluster); part, entry.firstcluster);
pdir->busy = false; pdir->busy = false;