summaryrefslogtreecommitdiff
path: root/extras/volume_id/lib/fat.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2008-11-13 19:40:24 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-11-13 19:40:24 +0100
commit387a8271207b4e921258194cf359039babbc33b9 (patch)
treefeac467726e0a97cd0a70cb44d9d0263fb2c7135 /extras/volume_id/lib/fat.c
parent779d2d851ee5dbd4c759bb973113373897d3adce (diff)
volume_id: fat - accept empty FAT32 fsinfo signature
Diffstat (limited to 'extras/volume_id/lib/fat.c')
-rw-r--r--extras/volume_id/lib/fat.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c
index 2d98b65b50..c0cfed82c0 100644
--- a/extras/volume_id/lib/fat.c
+++ b/extras/volume_id/lib/fat.c
@@ -411,7 +411,11 @@ magic:
fat32:
info("looking for FAT32\n");
- /* FAT32 should have a valid signature in the fsinfo block */
+ /*
+ * FAT32 should have a valid signature in the fsinfo block,
+ * but also allow all bytes set to '\0', because some volumes
+ * do not set the signature at all.
+ */
fsinfo_sect = le16_to_cpu(vs->type.fat32.fsinfo_sector);
buf = volume_id_get_buffer(id, off + (fsinfo_sect * sector_size), 0x200);
if (buf == NULL)
@@ -423,11 +427,13 @@ fat32:
info("signature2: 0x%02x%02x%02x%02x\n",
fsinfo->signature2[0], fsinfo->signature2[1],
fsinfo->signature2[2], fsinfo->signature2[3]);
- if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0)
+ if (memcmp(fsinfo->signature1, "\x52\x52\x61\x41", 4) != 0 &&
+ memcmp(fsinfo->signature1, "\x00\x00\x00\x00", 4) != 0)
return -1;
- if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0)
+ if (memcmp(fsinfo->signature2, "\x72\x72\x41\x61", 4) != 0 &&
+ memcmp(fsinfo->signature2, "\x00\x00\x00\x00", 4) != 0)
return -1 ;
- info("FAT32 signatures match\n");
+ info("FAT32 signatures ok\n");
vs = (struct vfat_super_block *) volume_id_get_buffer(id, off, 0x200);
if (vs == NULL)