OSDN Git Service

Turn "FS is larger than device" error into warning.
authorrelan <relan@users.noreply.github.com>
Sat, 11 Jul 2015 10:04:51 +0000 (13:04 +0300)
committerrelan <relan@users.noreply.github.com>
Mon, 24 Aug 2015 05:36:19 +0000 (08:36 +0300)
After formatting a memory card in a Panasonic Lumix DMC TZ-40 camera the
FS appears to be 512 bytes larger than underlying device size. This makes
the last cluster unaccessible. Not a big deal.

libexfat/mount.c

index 6e7881c..7ccdd4e 100644 (file)
@@ -253,14 +253,12 @@ int exfat_mount(struct exfat* ef, const char* spec, const char* options)
        if (le64_to_cpu(ef->sb->sector_count) * SECTOR_SIZE(*ef->sb) >
                        exfat_get_size(ef->dev))
        {
-               free(ef->zero_cluster);
-               exfat_error("file system is larger than underlying device: "
+               /* this can cause I/O errors later but we don't fail mounting to let
+                  user rescue data */
+               exfat_warn("file system is larger than underlying device: "
                                "%"PRIu64" > %"PRIu64,
                                le64_to_cpu(ef->sb->sector_count) * SECTOR_SIZE(*ef->sb),
                                exfat_get_size(ef->dev));
-               exfat_close(ef->dev);
-               free(ef->sb);
-               return -EIO;
        }
 
        ef->root = malloc(sizeof(struct exfat_node));