diff options
Diffstat (limited to 'disk-utils/fdisk-menu.c')
-rw-r--r-- | disk-utils/fdisk-menu.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/disk-utils/fdisk-menu.c b/disk-utils/fdisk-menu.c index 8ad0fc1a5..94e00b3fa 100644 --- a/disk-utils/fdisk-menu.c +++ b/disk-utils/fdisk-menu.c @@ -423,11 +423,24 @@ int process_fdisk_menu(struct fdisk_context **cxt0) prompt = _("Command (m for help): "); fputc('\n',stdout); - rc = get_user_reply(cxt, prompt, buf, sizeof(buf)); - if (rc) + rc = get_user_reply(prompt, buf, sizeof(buf)); + + if (rc == -ECANCELED) { + /* Map ^C and ^D in main menu to 'q' */ + if (is_interactive + && fdisk_label_is_changed(fdisk_get_label(cxt, NULL))) { + rc = get_user_reply( + _("\nDo you really want to quit? "), + buf, sizeof(buf)); + if (rc || !rpmatch(buf)) + return 0; + } + key = 'q'; + } else if (rc) { return rc; + } else + key = buf[0]; - key = buf[0]; ent = get_fdisk_menu_entry(cxt, key, &menu); if (!ent) { fdisk_warnx(cxt, _("%c: unknown command"), key); |