OSDN Git Service

Parse root directory on mount to catch FS errors earlier.
authorresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Thu, 27 May 2010 19:14:33 +0000 (19:14 +0000)
committerresver <resver@60bc1c72-a15a-11de-b98f-4500b42dc123>
Thu, 27 May 2010 19:14:33 +0000 (19:14 +0000)
git-svn-id: http://exfat.googlecode.com/svn/trunk@136 60bc1c72-a15a-11de-b98f-4500b42dc123

libexfat/mount.c

index 31f928a..42a8fc4 100644 (file)
@@ -97,6 +97,7 @@ static void parse_options(struct exfat* ef, const char* options)
 int exfat_mount(struct exfat* ef, const char* spec, const char* options)
 {
        uint16_t fs_version;
+       int rc;
 
        tzset();
        memset(ef, 0, sizeof(struct exfat));
@@ -184,6 +185,16 @@ int exfat_mount(struct exfat* ef, const char* spec, const char* options)
        /* always keep at least 1 reference to the root node */
        exfat_get_node(ef->root);
 
+       rc = exfat_cache_directory(ef, ef->root);
+       if (rc != 0)
+       {
+               free(ef->root);
+               free(ef->zero_block);
+               close(ef->fd);
+               free(ef->sb);
+               return rc;
+       }
+
        return 0;
 }