zkey: Make confirmation prompts more user friendly

Show '[y/N]' on all user confirmation prompts to give the user a
hint what to reply. Also indicate that the operation was aborted
on a negative confirmation.

Signed-off-by: Ingo Franzki <ifranzki@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Ingo Franzki
2019-08-07 13:04:20 +02:00
committed by Jan Höppner
parent 94227b44d5
commit 139dff3525
2 changed files with 10 additions and 6 deletions
+3 -1
View File
@@ -3072,7 +3072,8 @@ static int _keystore_prompt_for_remove(struct keystore *keystore,
_keystore_msg_for_volumes(msg, key_prop, VOLUME_TYPE_PLAIN);
free(msg);
printf("%s: Remove key '%s'? ", program_invocation_short_name, name);
printf("%s: Remove key '%s' [y/N]? ", program_invocation_short_name,
name);
if (fgets(str, sizeof(str), stdin) == NULL) {
rc = -EIO;
goto out;
@@ -3081,6 +3082,7 @@ static int _keystore_prompt_for_remove(struct keystore *keystore,
str[strlen(str) - 1] = '\0';
pr_verbose(keystore, "Prompt reply: '%s'", str);
if (strcasecmp(str, "y") != 0 && strcasecmp(str, "yes") != 0) {
warnx("Operation aborted");
rc = -ECANCELED;
goto out;
}