diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2010-03-15 12:32:04 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2010-03-15 12:32:04 +0000 |
commit | 42660535bec2200506c541392bd808a5ea9b102e (patch) | |
tree | c0c8e56b9073973d745c0206b4cde777b1430164 /firmware | |
parent | 46565f594a9601734b51be16999ad4914798bfc6 (diff) |
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
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/common/dir_uncached.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c index c6f3a6f2e1..e3e33a4c11 100644 --- a/firmware/common/dir_uncached.c +++ b/firmware/common/dir_uncached.c @@ -114,16 +114,20 @@ DIR_UNCACHED* opendir_uncached(const char* name) } if ( (entry.attr & FAT_ATTR_DIRECTORY) && (!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 * update the file metadata, but here we are only reading * a directory so there's no need for that kind of stuff. - * Consequently, we can safely pass NULL of it because - * fat_opendir and fat_open are NULL-protected. */ + * However, the rmdir_uncached function uses a ugly hack to + * 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,) &pdir->fatdir, entry.firstcluster, - NULL) < 0 ) { + &pdir->fatdir) < 0 ) { DEBUGF("Failed opening dir '%s' (%ld)\n", part, entry.firstcluster); pdir->busy = false; |