summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarel Zak <kzak@redhat.com>2008-11-13 17:32:14 +0100
committerKay Sievers <kay.sievers@vrfy.org>2008-11-13 17:32:14 +0100
commit3e39ff63658ed76398d0ee98f361221744fe591f (patch)
treeeedad9fcf42ada632b6e27ad7905c7b155190a36
parent1d36813d4c3353c1194d3a7cdb31ac6f64a66e8f (diff)
volume_id: fat - move check for msdos signature (0x55 0xaa)
Make the msdos signature (0x55 0xaa) at 510 and 511 optional when the standard FAT magic string is present.
-rw-r--r--extras/volume_id/lib/fat.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/extras/volume_id/lib/fat.c b/extras/volume_id/lib/fat.c
index 95735c2d2d..e30318cf09 100644
--- a/extras/volume_id/lib/fat.c
+++ b/extras/volume_id/lib/fat.c
@@ -281,10 +281,6 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size)
if (buf == NULL)
return -1;
- /* check signature */
- if (buf[510] != 0x55 || buf[511] != 0xaa)
- return -1;
-
vs = (struct vfat_super_block *) buf;
if (memcmp(vs->sysid, "NTFS", 4) == 0)
return -1;
@@ -305,6 +301,10 @@ int volume_id_probe_vfat(struct volume_id *id, uint64_t off, uint64_t size)
if (memcmp(vs->type.fat.magic, "FAT12 ", 8) == 0)
goto magic;
+ /* check signature */
+ if (buf[510] != 0x55 || buf[511] != 0xaa)
+ return -1;
+
/* some old floppies don't have a magic, expect the boot jump address to match */
if ((vs->boot_jump[0] != 0xeb || vs->boot_jump[2] != 0x90) &&
vs->boot_jump[0] != 0xe9)