[parted-devel] [PATCH 1/2] libparted: copy flags when duplicating GPT partitions

Brian C. Lane bcl at redhat.com
Mon Oct 31 23:35:16 UTC 2011


From: "Brian C. Lane" <bcl at redhat.com>

 * libparted/labels/gpt.c (gpt_partition_duplicate): copy flags to new
   partition.
 * NEWS: Mention this fix.
---
 NEWS                   |    3 +++
 libparted/labels/gpt.c |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/NEWS b/NEWS
index b7fb56b..915b5ff 100644
--- a/NEWS
+++ b/NEWS
@@ -8,6 +8,9 @@ GNU parted NEWS                                    -*- outline -*-
 
 ** Bug fixes
 
+  libparted: gpt_disk_duplicate now copies the flags over to the new
+  disk object. Previously the flags would be undefined.
+
   libparted: no longer aborts (failed assertion) due to a nilfs2_probe bug
   [bug introduced in parted-2.4 with the addition of nilfs2 support]
 
diff --git a/libparted/labels/gpt.c b/libparted/labels/gpt.c
index 8c9816f..7b4e014 100644
--- a/libparted/labels/gpt.c
+++ b/libparted/labels/gpt.c
@@ -1365,6 +1365,18 @@ gpt_partition_duplicate (const PedPartition *part)
   result_data->type = part_data->type;
   result_data->uuid = part_data->uuid;
   strcpy (result_data->name, part_data->name);
+
+  /* Copy over all the flags */
+  result_data->lvm = part_data->lvm;
+  result_data->raid = part_data->raid;
+  result_data->boot = part_data->boot;
+  result_data->bios_grub = part_data->bios_grub;
+  result_data->hp_service = part_data->hp_service;
+  result_data->hidden = part_data->hidden;
+  result_data->msftres = part_data->msftres;
+  result_data->atvrecv = part_data->atvrecv;
+  result_data->msftrecv = part_data->msftrecv;
+  result_data->legacy_boot = part_data->legacy_boot;
   return result;
 
 error_free_part:
-- 
1.7.6.4




More information about the parted-devel mailing list