From: Theodore Ts'o Date: Sun, 23 Sep 2007 13:50:11 +0000 (-0400) Subject: libblkid: Add more magic numbers that might mean there is a FAT filesystem X-Git-Url: http://git.kernel.org/?p=fs%2Fext2%2Fe2fsprogs.git;a=commitdiff_plain;h=846be6db813895c354cc54beaa8fa6aba8d98085 libblkid: Add more magic numbers that might mean there is a FAT filesystem The FAT filesystem doesn't have its superblock with a set of magic strings in a fixed location. Therefore, we must also check for the FAT filesystem if it looks like we have an MBR at the beginning of the partition. We previously checked if the first byte was a jump instruction but that missed some USB disks with only one bootable partition. Now we check for the MBR signature (0x55AA at offset 510) as well as any partition where byte 0 is \351 or \353. Signed-off-by: Karel Zak Signed-off-by: "Theodore Ts'o" --- diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c index 69a43b0..5c20127 100644 --- a/lib/blkid/probe.c +++ b/lib/blkid/probe.c @@ -846,8 +846,9 @@ static struct blkid_magic type_array[] = { { "vfat", 0, 0x36, 5, "MSDOS", probe_fat }, { "vfat", 0, 0x36, 8, "FAT16 ", probe_fat }, { "vfat", 0, 0x36, 8, "FAT12 ", probe_fat }, - { "vfat", 0, 0, 2, "\353\220", probe_fat_nomagic }, + { "vfat", 0, 0, 1, "\353", probe_fat_nomagic }, { "vfat", 0, 0, 1, "\351", probe_fat_nomagic }, + { "vfat", 0, 0x1fe, 2, "\125\252", probe_fat_nomagic }, { "minix", 1, 0x10, 2, "\177\023", 0 }, { "minix", 1, 0x10, 2, "\217\023", 0 }, { "minix", 1, 0x10, 2, "\150\044", 0 },