[parted-devel] [PATCH] Fix resizepart iec unit end sector

Phillip Susi psusi at ubuntu.com
Fri May 13 01:38:51 UTC 2016


Fix resizepart to adjust the end to be -1 sector when using iec
power of 2 units so that the next partition can start immediately
following the new end, just like mkpart does.
---
 NEWS            | 3 +++
 parted/parted.c | 5 ++++-
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/NEWS b/NEWS
index cf7b39c..eedf5e8 100644
--- a/NEWS
+++ b/NEWS
@@ -3,6 +3,9 @@ GNU parted NEWS                                    -*- outline -*-
 * Noteworthy changes in release ?.? (????-??-??) [?]
 
 ** Bug Fixes
+  Fix resizepart to adjust the end to be -1 sector when using iec
+  power of 2 units so that the next partition can start immediately
+  following the new end, just like mkpart does.
 
   Fix fat resize to preverve boot code, and thus not render the
   filesystem unreconized by Windows.
diff --git a/parted/parted.c b/parted/parted.c
index e6e4ac9..20ad9a6 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1554,8 +1554,11 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
 
         start = part->geom.start;
         end = oldend = part->geom.end;
-        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, NULL))
+        char *end_input;
+        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
                 goto error;
+        _adjust_end_if_iec(&start, &end, range_end, end_input);
+        free(end_input);
         /* Do not move start of the partition */
         constraint = constraint_from_start_end_fixed_start (*dev, start, range_end);
         if (!ped_disk_set_partition_geom (disk, part, constraint,
-- 
2.5.0




More information about the parted-devel mailing list