diff options
author | Karel Zak | 2013-03-12 11:58:34 +0100 |
---|---|---|
committer | Karel Zak | 2013-03-12 11:58:34 +0100 |
commit | 9ed268d0a780fb0a2c6e0a8888d167f37d5f1da0 (patch) | |
tree | 67449cf038711952344c597a21a49568eeb5f191 /fdisks/fdiskdoslabel.c | |
parent | fdisk: no more AIX "support" (diff) | |
download | kernel-qcow2-util-linux-9ed268d0a780fb0a2c6e0a8888d167f37d5f1da0.tar.gz kernel-qcow2-util-linux-9ed268d0a780fb0a2c6e0a8888d167f37d5f1da0.tar.xz kernel-qcow2-util-linux-9ed268d0a780fb0a2c6e0a8888d167f37d5f1da0.zip |
fdisk: improve MBR detection
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'fdisks/fdiskdoslabel.c')
-rw-r--r-- | fdisks/fdiskdoslabel.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c index 34465ef32..e2ec0d3b4 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; |