cryptsetup: improve error message when key files to load are too large

Let's make this easier to grok for users.

Prompted-by: #19193
This commit is contained in:
Lennart Poettering
2021-06-10 10:55:02 +02:00
parent f6dd48fae8
commit 871f35af85
2 changed files with 10 additions and 0 deletions
+4
View File
@@ -1261,6 +1261,10 @@ static int attach_luks_or_plain_or_bitlk_by_key_file(
READ_FULL_FILE_SECURE|READ_FULL_FILE_WARN_WORLD_READABLE|READ_FULL_FILE_CONNECT_SOCKET,
bindname,
&kfdata, &kfsize);
if (r == -E2BIG) {
log_error_errno(r, "Failed to activate, key file '%s' too large.", key_file);
return -EAGAIN;
}
if (r == -ENOENT) {
log_error_errno(r, "Failed to activate, key file '%s' missing.", key_file);
return -EAGAIN; /* Log actual error, but return EAGAIN */