cfdisk: fix menu behavior after writing changes
authorKarel Zak <kzak@redhat.com>
Mon, 26 Jun 2023 11:25:11 +0000 (13:25 +0200)
committerChris Hofstaedtler <zeha@debian.org>
Fri, 5 Jan 2024 14:25:05 +0000 (15:25 +0100)
Florian wrote:
  after a successful write, cfdisk remains on the "Write" cursor and
  furthermore when navigating to "Quit" will continue to  show
  "...without writing changes", despite there were writes. This patch
  addresses that.

Based on patch from Florian Zimmermann <florian.zimmermann@gmail.com>

Signed-off-by: Karel Zak <kzak@redhat.com>
Closes: #927041
Gbp-Pq: Topic upstream
Gbp-Pq: Name cfdisk-fix-menu-behavior-after-writing-changes.patch

disk-utils/cfdisk.c

index fde20295ef9989b6846ec3e0c38d79d93d44d226..3fe852ac244b594e7f480c32dd5fee6ec3e17131 100644 (file)
@@ -2525,11 +2525,15 @@ static int main_menu_action(struct cfdisk *cf, int key)
                if (rc)
                        warn = _("Failed to write disklabel.");
                else {
+                       size_t q_idx = 0;
+
                        if (cf->device_is_used)
                                fdisk_reread_changes(cf->cxt, cf->original_layout);
                        else
                                fdisk_reread_partition_table(cf->cxt);
                        info = _("The partition table has been altered.");
+                       if (menu_get_menuitem_by_key(cf, 'q', &q_idx))
+                               ui_menu_goto(cf, q_idx);
                }
                cf->nwrites++;
                break;