diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-11-16 03:24:17 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-11-16 03:24:17 +0100 |
commit | 494856b55c78e92109891cf453fc831544efc488 (patch) | |
tree | 4b519c1fe1448f0d5695b32b39d3a345329cc5b7 /src | |
parent | b853f6e9d60c0eab2038227718ee1ed1266f94de (diff) |
cryptsetup: include device name in password question
Diffstat (limited to 'src')
-rw-r--r-- | src/cryptsetup.c | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/src/cryptsetup.c b/src/cryptsetup.c index c103aa9e03..5afac6482f 100644 --- a/src/cryptsetup.c +++ b/src/cryptsetup.c @@ -232,8 +232,17 @@ int main(int argc, char *argv[]) { password = NULL; if (!key_file) { + char *text; - if ((k = ask_password_auto("Please enter passphrase for disk:", "drive-harddisk", until, &password)) < 0) { + if (asprintf(&text, "Please enter passphrase for disk %s", argv[3]) < 0) { + log_error("Out of memory"); + goto finish; + } + + k = ask_password_auto(text, "drive-harddisk", until, &password); + free(text); + + if (k < 0) { log_error("Failed to query password: %s", strerror(-k)); goto finish; } @@ -241,7 +250,15 @@ int main(int argc, char *argv[]) { if (opt_verify) { char *password2 = NULL; - if ((k = ask_password_auto("Please enter passphrase for disk (verification):", "drive-harddisk", until, &password2)) < 0) { + if (asprintf(&text, "Please enter passphrase for disk %s (verification)", argv[3]) < 0) { + log_error("Out of memory"); + goto finish; + } + + k = ask_password_auto(text, "drive-harddisk", until, &password2); + free(text); + + if (k < 0) { log_error("Failed to query verification password: %s", strerror(-k)); goto finish; } |