summaryrefslogtreecommitdiffstats
path: root/libfdisk/src/dos.c
diff options
context:
space:
mode:
authorKarel Zak2014-08-29 09:19:13 +0200
committerKarel Zak2014-08-29 09:19:13 +0200
commit7bc31adac4d08c5efaf3ab97d4523c4a1d8d3623 (patch)
tree5a2f75521bfcd727e6804a0b3459d8fd423873b7 /libfdisk/src/dos.c
parentlibfdisk: (gpt) allow to specify uuid and name when create new partition (diff)
downloadkernel-qcow2-util-linux-7bc31adac4d08c5efaf3ab97d4523c4a1d8d3623.tar.gz
kernel-qcow2-util-linux-7bc31adac4d08c5efaf3ab97d4523c4a1d8d3623.tar.xz
kernel-qcow2-util-linux-7bc31adac4d08c5efaf3ab97d4523c4a1d8d3623.zip
libfdisk: (dos) follow bootable setting when add partition
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'libfdisk/src/dos.c')
-rw-r--r--libfdisk/src/dos.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/libfdisk/src/dos.c b/libfdisk/src/dos.c
index 13bde11e6..15ea6642f 100644
--- a/libfdisk/src/dos.c
+++ b/libfdisk/src/dos.c
@@ -815,7 +815,7 @@ static int is_dos_partition(int t)
static void set_partition(struct fdisk_context *cxt,
int i, int doext, sector_t start,
- sector_t stop, int sysid)
+ sector_t stop, int sysid, int boot)
{
struct pte *pe = self_pte(cxt, i);
struct dos_partition *p;
@@ -838,7 +838,7 @@ static void set_partition(struct fdisk_context *cxt,
(size_t) (stop - start + 1),
sysid));
- p->boot_ind = 0;
+ p->boot_ind = boot ? 1 : 0;
p->sys_ind = sysid;
dos_partition_set_start(p, start - offset);
dos_partition_set_size(p, stop - start + 1);
@@ -1132,11 +1132,11 @@ static int add_partition(struct fdisk_context *cxt, size_t n,
}
}
- set_partition(cxt, n, 0, start, stop, sys);
+ set_partition(cxt, n, 0, start, stop, sys, pa ? pa->boot : 0);
if (n > 4) {
struct pte *pe = self_pte(cxt, n);
set_partition(cxt, n - 1, 1, pe->offset, stop,
- MBR_DOS_EXTENDED_PARTITION);
+ MBR_DOS_EXTENDED_PARTITION, 0);
}
if (IS_EXTENDED(sys)) {
@@ -1848,7 +1848,8 @@ again:
(uintmax_t) ooff, (uintmax_t) noff));
set_partition(cxt, i, 1, nxt->offset,
- get_abs_partition_end(nxt), MBR_DOS_EXTENDED_PARTITION);
+ get_abs_partition_end(nxt),
+ MBR_DOS_EXTENDED_PARTITION, 0);
if (i + 1 == cxt->label->nparts_max - 1) {
clear_partition(nxt->ex_entry);