54 lines
1.9 KiB
Diff
54 lines
1.9 KiB
Diff
|
From 691dabc930a6d544dfd8da787cddd159bab34b1e Mon Sep 17 00:00:00 2001
|
||
|
From: "Brian C. Lane" <bcl@redhat.com>
|
||
|
Date: Mon, 31 Aug 2020 16:40:07 -0700
|
||
|
Subject: [PATCH 11/12] parted: Preserve resizepart End when prompted for busy
|
||
|
partition
|
||
|
|
||
|
Resizing busy partitions is allowed, but the user is prompted, which
|
||
|
erases the cmdline. It is annoying to have to re-end the ending location
|
||
|
after answering Yes. This saves the word and pushes it back onto the
|
||
|
cmdline after the user agrees to resize the busy partition.
|
||
|
---
|
||
|
parted/parted.c | 15 +++++++++++++++
|
||
|
1 file changed, 15 insertions(+)
|
||
|
|
||
|
diff --git a/parted/parted.c b/parted/parted.c
|
||
|
index df0c7ed..dbd38d0 100644
|
||
|
--- a/parted/parted.c
|
||
|
+++ b/parted/parted.c
|
||
|
@@ -1546,6 +1546,7 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
|
||
|
PedConstraint* constraint;
|
||
|
int rc = 0;
|
||
|
char* end_input = NULL;
|
||
|
+ char* end_size = NULL;
|
||
|
|
||
|
if (!disk) {
|
||
|
disk = ped_disk_new (*dev);
|
||
|
@@ -1561,9 +1562,23 @@ do_resizepart (PedDevice** dev, PedDisk** diskp)
|
||
|
|
||
|
if (!command_line_get_partition (_("Partition number?"), disk, &part))
|
||
|
goto error;
|
||
|
+
|
||
|
+ /* Save the optional End value if the partition is busy. */
|
||
|
+ if (ped_partition_is_busy(part)) {
|
||
|
+ if (command_line_get_word_count())
|
||
|
+ end_size = command_line_pop_word();
|
||
|
+ }
|
||
|
+
|
||
|
+ /* If the partition is busy this may clear the command_line and prompt the user */
|
||
|
if (!_partition_warn_busy (part))
|
||
|
goto error;
|
||
|
|
||
|
+ /* Push the End value back onto the command_line, if it exists */
|
||
|
+ if (end_size) {
|
||
|
+ command_line_push_word(end_size);
|
||
|
+ free(end_size);
|
||
|
+ }
|
||
|
+
|
||
|
start = part->geom.start;
|
||
|
end = oldend = part->geom.end;
|
||
|
if (!command_line_get_sector (_("End?"), *dev, &end, &range_end, &end_input))
|
||
|
--
|
||
|
2.26.2
|
||
|
|