diff options
author | Karel Zak | 2013-06-12 17:32:03 +0200 |
---|---|---|
committer | Karel Zak | 2013-06-12 17:39:09 +0200 |
commit | 76b86412c607ba47f43ef7c0535436bca2a660d2 (patch) | |
tree | c61930713a5d278613a3ab64096c40b69b5b21ac | |
parent | textual: improve clarity of some error messages (diff) | |
download | kernel-qcow2-util-linux-76b86412c607ba47f43ef7c0535436bca2a660d2.tar.gz kernel-qcow2-util-linux-76b86412c607ba47f43ef7c0535436bca2a660d2.tar.xz kernel-qcow2-util-linux-76b86412c607ba47f43ef7c0535436bca2a660d2.zip |
fdisk: don't use ptes[] in generic code
... the array is MBR specific.
Signed-off-by: Karel Zak <kzak@redhat.com>
-rw-r--r-- | fdisks/fdisk.c | 6 | ||||
-rw-r--r-- | fdisks/fdiskdoslabel.c | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/fdisks/fdisk.c b/fdisks/fdisk.c index 623f16856..33049da18 100644 --- a/fdisks/fdisk.c +++ b/fdisks/fdisk.c @@ -576,7 +576,6 @@ static void delete_partition(struct fdisk_context *cxt, int partnum) if (partnum < 0 || warn_geometry(cxt)) return; - ptes[partnum].changed = 1; if (fdisk_delete_partition(cxt, partnum) != 0) printf(_("Could not delete partition %d\n"), partnum + 1); else @@ -604,7 +603,6 @@ static void change_partition_type(struct fdisk_context *cxt) continue; if (fdisk_set_partition_type(cxt, i, t) == 0) { - ptes[i].changed = 1; printf (_("Changed type of partition '%s' to '%s'\n"), org_t ? org_t->name : _("Unknown"), t ? t->name : _("Unknown")); @@ -795,8 +793,10 @@ static void print_raw(struct fdisk_context *cxt) fdisk_is_disklabel(cxt, GPT)) print_buffer(cxt, cxt->firstsector); - else for (i = 3; i < cxt->label->nparts_max; i++) + else if (fdisk_is_disklabel(cxt, DOS)) { + for (i = 3; i < cxt->label->nparts_max; i++) print_buffer(cxt, ptes[i].sectorbuffer); + } } static void __attribute__ ((__noreturn__)) handle_quit(struct fdisk_context *cxt) diff --git a/fdisks/fdiskdoslabel.c b/fdisks/fdiskdoslabel.c index 415f222ca..5fd1da823 100644 --- a/fdisks/fdiskdoslabel.c +++ b/fdisks/fdiskdoslabel.c @@ -190,6 +190,7 @@ static int dos_delete_partition(struct fdisk_context *cxt, size_t partnum) ptes[ext_index].ext_pointer = NULL; extended_offset = 0; } + ptes[partnum].changed = 1; clear_partition(p); } else if (!q->sys_ind && partnum > 4) { /* the last one in the chain - just delete */ @@ -1100,6 +1101,7 @@ static int dos_set_parttype( "partitions, please see the fdisk manual page for additional " "information.\n\n")); + ptes[partnum].changed = 1; p->sys_ind = t->type; fdisk_label_set_changed(cxt->label, 1); return 0; |