From 9ed268d0a780fb0a2c6e0a8888d167f37d5f1da0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Tue, 12 Mar 2013 11:58:34 +0100 Subject: [PATCH] fdisk: improve MBR detection Signed-off-by: Karel Zak --- fdisks/fdiskdoslabel.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c index 34465ef327..e2ec0d3b4b 100644 --- a/fdisks/fdiskdoslabel.c +++ b/fdisks/fdiskdoslabel.c @@ -428,6 +428,10 @@ static int dos_reset_alignment(struct fdisk_context *cxt) return 0; } +/* TODO: move to include/pt-dos.h and share with libblkid */ +#define AIX_MAGIC_STRING "\xC9\xC2\xD4\xC1" +#define AIX_MAGIC_STRLEN (sizeof(AIX_MAGIC_STRING) - 1) + static int dos_probe_label(struct fdisk_context *cxt) { size_t i; @@ -437,6 +441,10 @@ static int dos_probe_label(struct fdisk_context *cxt) assert(cxt->label); assert(fdisk_is_disklabel(cxt, DOS)); + /* ignore disks with AIX magic number */ + if (memcmp(cxt->firstsector, AIX_MAGIC_STRING, AIX_MAGIC_STRLEN) == 0) + return 0; + if (!mbr_is_valid_magic(cxt->firstsector)) return 0; -- 2.47.3