63 lines
2.1 KiB
Diff
63 lines
2.1 KiB
Diff
From 376484140cb7ef117616ac2880bd8ec18381b18f Mon Sep 17 00:00:00 2001
|
|
From: Karel Zak <kzak@redhat.com>
|
|
Date: Mon, 13 Apr 2015 10:29:00 +0200
|
|
Subject: [PATCH 2/5] libfdisk: (dos) retain existing boot flag when resizing
|
|
a partition
|
|
|
|
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1210912
|
|
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
Co-Author: awilliam@redhat.com
|
|
---
|
|
libfdisk/src/dos.c | 8 +++++---
|
|
libfdisk/src/partition.c | 3 +--
|
|
2 files changed, 6 insertions(+), 5 deletions(-)
|
|
|
|
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
|
|
index dce9829..6468071 100644
|
|
--- a/libfdisk/src/dos.c
|
|
+++ b/libfdisk/src/dos.c
|
|
@@ -1221,7 +1221,7 @@ static int add_partition(struct fdisk_context *cxt, size_t n,
|
|
}
|
|
}
|
|
|
|
- set_partition(cxt, n, 0, start, stop, sys, pa && pa->boot == 1 ? 1 : 0);
|
|
+ set_partition(cxt, n, 0, start, stop, sys, fdisk_partition_is_bootable(pa));
|
|
if (n > 4) {
|
|
struct pte *pe = self_pte(cxt, n);
|
|
set_partition(cxt, n - 1, 1, pe->offset, stop,
|
|
@@ -1963,13 +1963,15 @@ static int dos_set_partition(struct fdisk_context *cxt, size_t n,
|
|
|
|
set_partition(cxt, n, 0, start, start + size - 1,
|
|
pa->type ? pa->type->code : p->sys_ind,
|
|
- pa->boot == 1);
|
|
+ FDISK_IS_UNDEF(pa->boot) ?
|
|
+ p->boot_ind == ACTIVE_FLAG :
|
|
+ fdisk_partition_is_bootable(pa));
|
|
} else {
|
|
DBG(LABEL, ul_debug("DOS: keep size, modify properties"));
|
|
if (pa->type)
|
|
p->sys_ind = pa->type->code;
|
|
if (!FDISK_IS_UNDEF(pa->boot))
|
|
- p->boot_ind = pa->boot == 1 ? ACTIVE_FLAG : 0;
|
|
+ p->boot_ind = fdisk_partition_is_bootable(pa) ? ACTIVE_FLAG : 0;
|
|
}
|
|
|
|
partition_set_changed(cxt, n, 1);
|
|
diff --git a/libfdisk/src/partition.c b/libfdisk/src/partition.c
|
|
index 03c0eb5..a0b9ca5 100644
|
|
--- a/libfdisk/src/partition.c
|
|
+++ b/libfdisk/src/partition.c
|
|
@@ -757,8 +757,7 @@ int fdisk_partition_to_string(struct fdisk_partition *pa,
|
|
}
|
|
break;
|
|
case FDISK_FIELD_BOOT:
|
|
- if (fdisk_partition_is_bootable(pa))
|
|
- rc = asprintf(&p, "%c", pa->boot ? '*' : ' ');
|
|
+ p = fdisk_partition_is_bootable(pa) ? strdup("*") : NULL;
|
|
break;
|
|
case FDISK_FIELD_START:
|
|
if (fdisk_partition_has_start(pa)) {
|
|
--
|
|
2.1.0
|
|
|