aboutsummaryrefslogtreecommitdiffstats
path: root/fsck
diff options
context:
space:
mode:
authorrelan <relan@users.noreply.github.com>2009-10-22 18:38:01 +0000
committerrelan <relan@users.noreply.github.com>2015-08-24 08:26:10 +0300
commit77f4a93e89b8672ac5aef08cb82df8ee7d601956 (patch)
tree622d4a6771496eae7b0ef9b0733984c69b9c98e2 /fsck
parenta2b6db4613aadbdedc6ec5ea4f4c8f797a460dc8 (diff)
downloadandroid_external_exfat-77f4a93e89b8672ac5aef08cb82df8ee7d601956.tar.gz
android_external_exfat-77f4a93e89b8672ac5aef08cb82df8ee7d601956.tar.bz2
android_external_exfat-77f4a93e89b8672ac5aef08cb82df8ee7d601956.zip
Implement nodes cache (in-core directory structure representation).
This is a prerequisite for write support and further performance improvements.
Diffstat (limited to 'fsck')
-rw-r--r--fsck/main.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/fsck/main.c b/fsck/main.c
index e516650..9d21049 100644
--- a/fsck/main.c
+++ b/fsck/main.c
@@ -63,6 +63,7 @@ static void dirck(struct exfat* ef, const char* path)
struct exfat_node* parent;
struct exfat_node* node;
struct exfat_iterator it;
+ int rc;
char subpath[EXFAT_NAME_MAX + 1];
if (exfat_lookup(ef, &parent, path) != 0)
@@ -70,8 +71,14 @@ static void dirck(struct exfat* ef, const char* path)
if (!(parent->flags & EXFAT_ATTRIB_DIR))
exfat_bug("`%s' is not a directory (0x%x)", path, parent->flags);
- exfat_opendir(parent, &it);
- while (exfat_readdir(ef, parent, &node, &it) == 0)
+ rc = exfat_opendir(ef, parent, &it);
+ if (rc != 0)
+ {
+ exfat_put_node(parent);
+ exfat_error("failed to open directory `%s'", path);
+ return;
+ }
+ while ((node = exfat_readdir(ef, &it)))
{
strcpy(subpath, path);
strcat(subpath, "/");