diff options
author | Brian C. Lane <bcl@redhat.com> | 2020-08-31 16:40:07 -0700 |
---|---|---|
committer | Brian C. Lane <bcl@redhat.com> | 2020-08-31 16:40:07 -0700 |
commit | 691dabc930a6d544dfd8da787cddd159bab34b1e (patch) | |
tree | 4b938711014783d46fd91c10e38681a90c4e9a0b /parted | |
parent | eaada0bc9e1cc8adb3a0260707d9474a3e01b835 (diff) | |
download | parted-691dabc930a6d544dfd8da787cddd159bab34b1e.tar.gz |
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.
Diffstat (limited to 'parted')
-rw-r--r-- | parted/parted.c | 15 |
1 files changed, 15 insertions, 0 deletions
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)) |