summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAmaury Pouly <pamaury@rockbox.org>2010-03-15 12:32:04 +0000
committerAmaury Pouly <pamaury@rockbox.org>2010-03-15 12:32:04 +0000
commit42660535bec2200506c541392bd808a5ea9b102e (patch)
treec0c8e56b9073973d745c0206b4cde777b1430164
parent46565f594a9601734b51be16999ad4914798bfc6 (diff)
downloadrockbox-42660535bec2200506c541392bd808a5ea9b102e.tar.gz
rockbox-42660535bec2200506c541392bd808a5ea9b102e.zip
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
-rw-r--r--firmware/common/dir_uncached.c12
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)
114 } 114 }
115 if ( (entry.attr & FAT_ATTR_DIRECTORY) && 115 if ( (entry.attr & FAT_ATTR_DIRECTORY) &&
116 (!strcasecmp(part, entry.name)) ) { 116 (!strcasecmp(part, entry.name)) ) {
117 /* in reality, the parent_dir parameter of fat_opendir is 117 /* In reality, the parent_dir parameter of fat_opendir seems
118 * useless because it's sole purpose it to have a way to 118 * useless because it's sole purpose it to have a way to
119 * update the file metadata, but here we are only reading 119 * update the file metadata, but here we are only reading
120 * a directory so there's no need for that kind of stuff. 120 * a directory so there's no need for that kind of stuff.
121 * Consequently, we can safely pass NULL of it because 121 * However, the rmdir_uncached function uses a ugly hack to
122 * fat_opendir and fat_open are NULL-protected. */ 122 * avoid opening a directory twice when deleting it and thus
123 * needs those information. That's why we pass pdir->fatdir both
124 * as the parent directory and the resulting one (this is safe,
125 * in doubt, check fat_open(dir) code) which will allow this kind of
126 * (ugly) things */
123 if ( fat_opendir(IF_MV2(volume,) 127 if ( fat_opendir(IF_MV2(volume,)
124 &pdir->fatdir, 128 &pdir->fatdir,
125 entry.firstcluster, 129 entry.firstcluster,
126 NULL) < 0 ) { 130 &pdir->fatdir) < 0 ) {
127 DEBUGF("Failed opening dir '%s' (%ld)\n", 131 DEBUGF("Failed opening dir '%s' (%ld)\n",
128 part, entry.firstcluster); 132 part, entry.firstcluster);
129 pdir->busy = false; 133 pdir->busy = false;