summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/dos.c
diff options
context:
space:
mode:
authorKarel Zak2019-07-17 12:11:38 +0200
committerKarel Zak2019-07-17 12:11:38 +0200
commit7c643ed2855058657798d9e8e80701023de14a08 (patch)
treeb53be6c3afb4013f5b2fd2049640141c08adc463 /libfdisk/src/dos.c
parentbuild-sys: improve hwclock CMOS dependences (diff)
downloadkernel-qcow2-util-linux-7c643ed2855058657798d9e8e80701023de14a08.tar.gz
kernel-qcow2-util-linux-7c643ed2855058657798d9e8e80701023de14a08.tar.xz
kernel-qcow2-util-linux-7c643ed2855058657798d9e8e80701023de14a08.zip
libfdisk: don't use FAT as MBR
The current libfdisk MBR detection is too weak, the result is that it reuses MBR from FAT. The correct behavior is to create a new MBR, wipe first sector (on write) and warn about obsolete FAT superblock. Reported-by: Mike Fleetwood <mike.fleetwood@googlemail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/dos.c')
-rw-r--r--libfdisk/src/dos.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 6dc276e8a..bd964db15 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -814,6 +814,10 @@ static int dos_probe_label(struct fdisk_context *cxt)
if (!mbr_is_valid_magic(cxt->firstsector))
return 0;
+ /* ignore disks with FAT */
+ if (cxt->collision && strcmp(cxt->collision, "vfat") == 0)
+ return 0;
+
dos_init(cxt);
get_partition_table_geometry(cxt, &h, &s);