From: Harald Hoyer <[email protected]>
If the key file cannot be accessed, we can at least ask for the
password.
---
Remove access() call and check the return value of
crypt_activate_by_keyfile_offset()
src/cryptsetup/cryptsetup.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/src/cryptsetup/cryptsetup.c b/src/cryptsetup/cryptsetup.c
index 376f748..a24e61a 100644
--- a/src/cryptsetup/cryptsetup.c
+++ b/src/cryptsetup/cryptsetup.c
@@ -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;
--
1.8.2
_______________________________________________
systemd-devel mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/systemd-devel