diff options
Diffstat (limited to 'firmware/common/file.c')
-rw-r--r-- | firmware/common/file.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/firmware/common/file.c b/firmware/common/file.c index 8f6bfa051b..cfebd0622f 100644 --- a/firmware/common/file.c +++ b/firmware/common/file.c | |||
@@ -108,25 +108,26 @@ static int open_internal(const char* pathname, int flags, bool use_cache) | |||
108 | #ifdef HAVE_DIRCACHE | 108 | #ifdef HAVE_DIRCACHE |
109 | if (dircache_is_enabled() && !file->write && use_cache) | 109 | if (dircache_is_enabled() && !file->write && use_cache) |
110 | { | 110 | { |
111 | const struct dircache_entry *ce; | ||
112 | # ifdef HAVE_MULTIVOLUME | 111 | # ifdef HAVE_MULTIVOLUME |
113 | int volume = strip_volume(pathname, pathnamecopy); | 112 | int volume = strip_volume(pathname, pathnamecopy); |
114 | # endif | 113 | # endif |
115 | 114 | ||
116 | ce = dircache_get_entry_ptr(pathname); | 115 | int ce = dircache_get_entry_id(pathname); |
117 | if (!ce) | 116 | if (ce < 0) |
118 | { | 117 | { |
119 | errno = ENOENT; | 118 | errno = ENOENT; |
120 | file->busy = false; | 119 | file->busy = false; |
121 | return -7; | 120 | return -7; |
122 | } | 121 | } |
123 | 122 | ||
123 | long startcluster = _dircache_get_entry_startcluster(ce); | ||
124 | fat_open(IF_MV2(volume,) | 124 | fat_open(IF_MV2(volume,) |
125 | ce->startcluster, | 125 | startcluster, |
126 | &(file->fatfile), | 126 | &(file->fatfile), |
127 | NULL); | 127 | NULL); |
128 | file->size = ce->info.size; | 128 | struct dirinfo *info = _dircache_get_entry_dirinfo(ce); |
129 | file->attr = ce->info.attribute; | 129 | file->size = info->size; |
130 | file->attr = info->attribute; | ||
130 | file->cacheoffset = -1; | 131 | file->cacheoffset = -1; |
131 | file->fileoffset = 0; | 132 | file->fileoffset = 0; |
132 | 133 | ||