summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiika Pekkarinen <miipekk@ihme.org>2005-10-09 07:32:23 +0000
committerMiika Pekkarinen <miipekk@ihme.org>2005-10-09 07:32:23 +0000
commit20bc58dc9ad8feb927e0c805f9dbfb5b6a024ccd (patch)
tree1a5ac14752ce3f3b4eca93699b36b06487d3d4f7
parent104d38cd8bf44357e07d8e6ba335014474ab4eab (diff)
Do not try to read from dircache if directory was opened when cache was not
available. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7602 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--firmware/common/dircache.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c
index 4cd01ec924..ca07a35989 100644
--- a/firmware/common/dircache.c
+++ b/firmware/common/dircache.c
@@ -743,10 +743,8 @@ struct dircache_entry* readdir_cached(DIRCACHED* dir)
if (!dir->busy)
return NULL;
- if (!dircache_initialized)
+ if (dir->regulardir != NULL)
{
- if (dir->regulardir == NULL)
- return NULL;
regentry = readdir(dir->regulardir);
if (regentry == NULL)
return NULL;
@@ -789,8 +787,11 @@ struct dircache_entry* readdir_cached(DIRCACHED* dir)
int closedir_cached(DIRCACHED* dir)
{
+ if (!dir->busy)
+ return -1;
+
dir->busy=false;
- if (!dircache_initialized && dir->regulardir != NULL)
+ if (dir->regulardir != NULL)
return closedir(dir->regulardir);
return 0;