summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/dos.c
diff options
context:
space:
mode:
authorKarel Zak2013-10-23 16:59:45 +0200
committerKarel Zak2013-10-23 16:59:45 +0200
commit433d05ff9afeb4a374943cb35d1b8b19613c8039 (patch)
tree8309076ac324b0882fb92484aa58c6a835d3432a /libfdisk/src/dos.c
parentlibfdisk: (gpt) improve and cleanup recovery code (diff)
downloadkernel-qcow2-util-linux-433d05ff9afeb4a374943cb35d1b8b19613c8039.tar.gz
kernel-qcow2-util-linux-433d05ff9afeb4a374943cb35d1b8b19613c8039.tar.xz
kernel-qcow2-util-linux-433d05ff9afeb4a374943cb35d1b8b19613c8039.zip
libfdisk: (gpt) allow to work with hybrid GPT
Notes: * fdisk don't sync hybrid MBR with GPT * hybrid MBR is ignored and not overwritten by PBMR * users is informed about expert command 'M' to toggle between MBR and GPT mode. It's possible to manually modify hybrid MBR. Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/dos.c')
-rw-r--r--libfdisk/src/dos.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 11d3c71f4..8b51b8c53 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -815,7 +815,11 @@ static int add_partition(struct fdisk_context *cxt, size_t n, struct fdisk_partt
}
fill_bounds(cxt, first, last);
if (n < 4) {
- start = cxt->first_lba;
+ if (cxt->parent && fdisk_is_disklabel(cxt->parent, GPT))
+ start = 1; /* Bad boy modifies hybrid MBR */
+ else
+ start = cxt->first_lba;
+
if (fdisk_context_use_cylinders(cxt) || !cxt->total_sectors)
limit = cxt->geom.heads * cxt->geom.sectors * cxt->geom.cylinders - 1;
else