chiark / gitweb /
cryptsetup: ask for password, if key file cannot be accessed
authorHarald Hoyer <harald@redhat.com>
Thu, 18 Apr 2013 07:41:23 +0000 (09:41 +0200)
committerLennart Poettering <lennart@poettering.net>
Thu, 18 Apr 2013 20:17:13 +0000 (22:17 +0200)
If the key file cannot be accessed, we can at least ask for the
password.

src/cryptsetup/cryptsetup.c

index 376f748153348e40ae8dd7c461b91a2da87a8ec2..a24e61a0358e2a7a1f947f939ddba4b4046d321f 100644 (file)
@@ -500,6 +500,11 @@ int main(int argc, char *argv[]) {
                         if (key_file)
                                 k = crypt_activate_by_keyfile_offset(cd, argv[2], CRYPT_ANY_SLOT, key_file, opt_keyfile_size,
                                             opt_keyfile_offset, flags);
+                                if (k < 0) {
+                                        log_error("Failed to activate with key file '%s': %s", key_file, strerror(-k));
+                                        key_file = NULL;
+                                        continue;
+                                }
                         else {
                                 char **p;