parted/parted-1.8.8-dospartrec.patch
2008-05-29 17:26:02 +00:00

29 lines
1.1 KiB
Diff

diff --git a/libparted/labels/dos.c b/libparted/labels/dos.c
index e513a05..81d8600 100644
--- a/libparted/labels/dos.c
+++ b/libparted/labels/dos.c
@@ -192,14 +192,16 @@ msdos_probe (const PedDevice *dev)
if (PED_LE16_TO_CPU (part_table->magic) != MSDOS_MAGIC)
goto probe_fail;
- /* if this is a FAT fs, fail here. Note that the Smart Boot Manager
- * Loader (SBML) signature indicates a partition table, not a file
- * system.
+ /* If this is a FAT fs, fail here. Checking for the FAT signature
+ * has some false positives; instead, do what the Linux kernel does
+ * and ensure that each partition has a boot indicator that is
+ * either 0 or 0x80.
*/
- if ((!strncmp (part_table->boot_code + 0x36, "FAT", 3)
- && strncmp (part_table->boot_code + 0x40, "SBML", 4) != 0)
- || !strncmp (part_table->boot_code + 0x52, "FAT", 3))
- goto probe_fail;
+ for (i = 0; i < 4; i++) {
+ if (part_table->partitions[i].boot_ind != 0
+ && part_table->partitions[i].boot_ind != 0x80)
+ goto probe_fail;
+ }
/* If this is a GPT disk, fail here */
for (i = 0; i < 4; i++) {