Do the same adjustment for the end argument to resizepart that
we do for the arguments to mkpart if they are specified in IEC
units. This makes the behaviour of the two commands more
consistent.

Signed-off-by: Will Newton <[email protected]>
---
 NEWS            | 7 +++++++
 parted/parted.c | 5 ++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

Changes in v2:
 - Add NEWS entry

diff --git a/NEWS b/NEWS
index bb15212..0cee589 100644
--- a/NEWS
+++ b/NEWS
@@ -33,6 +33,13 @@ GNU parted NEWS                                    -*- 
outline -*-
   and a cylinder has a size which is power of 2, then such address
   does not trigger exact placement.
 
+** Changes in behavior
+
+  parted: the reizepart command has changed semantics with regard to specifying
+  the end of the partition.  If the end is specified using units of MiB, GiB,
+  etc., parted subtracts one sector from the specified value.  With this
+  change, resizepart and mkpart behave in a consistent manner.
+
 * Noteworthy changes in release 3.2 (2014-07-28) [stable]
 
 ** New Features
diff --git a/parted/parted.c b/parted/parted.c
index c471d49..0237fb0 100644
--- a/parted/parted.c
+++ b/parted/parted.c
@@ -1564,10 +1564,13 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
         if (!_partition_warn_busy (part))
                 goto error;
 
+       char *end_input;
+       PedSector dummy_start;
         start = part->geom.start;
         end = oldend = part->geom.end;
-        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, NULL))
+        if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, 
&end_input))
                 goto error;
+        _adjust_end_if_iec(&dummy_start, &end, range_end, 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.9.4


Reply via email to