[PATCH parted 5/5] parted: When retrying mkpart keep the device constraint

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



When retrying mkpart when the part addition to the disk with the constraint
derived from the user specified start and end fails, keep the device constraint
otherwise the result of the retry may end up being not properly aligned.
---
 parted/parted.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/parted/parted.c b/parted/parted.c
index 30500db..b44519b 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -776,7 +776,6 @@ do_mkpart (PedDevice** dev)
         final_constraint = ped_constraint_intersect (user_constraint,
                         dev_constraint);
         ped_constraint_destroy (user_constraint);
-        ped_constraint_destroy (dev_constraint);
         if (!final_constraint)
                 goto error_destroy_simple_constraints;
 
@@ -787,8 +786,7 @@ do_mkpart (PedDevice** dev)
         if (!added_ok) {
                 ped_exception_leave_all();
 
-                if (ped_disk_add_partition (disk, part,
-                                        ped_constraint_any (*dev))) {
+                if (ped_disk_add_partition (disk, part, dev_constraint)) {
                         start_usr = ped_unit_format (*dev, start);
                         end_usr   = ped_unit_format (*dev, end);
                         start_sol = ped_unit_format (*dev, part->geom.start);
@@ -829,6 +827,7 @@ do_mkpart (PedDevice** dev)
                 ped_exception_leave_all();
         }
         ped_exception_catch();
+        ped_constraint_destroy (dev_constraint);
 
         /* set minor attributes */
         if (part_name)
@@ -862,6 +861,7 @@ do_mkpart (PedDevice** dev)
 error_remove_part:
         ped_disk_remove_partition (disk, part);
 error_destroy_simple_constraints:
+        ped_constraint_destroy (dev_constraint);
         ped_partition_destroy (part);
 error_destroy_disk:
         ped_disk_destroy (disk);
-- 
1.6.5.1

_______________________________________________
Anaconda-devel-list mailing list
Anaconda-devel-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/anaconda-devel-list

[Index of Archives]     [Kickstart]     [Fedora Users]     [Fedora Legacy List]     [Fedora Maintainers]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]
  Powered by Linux