Explicitly print error message if keyslot open failed.

The only quiet message now is EPERM (wrong password) that is
processed by the caller.

Fixes #488.
This commit is contained in:
Milan Broz
2019-10-11 14:06:49 +02:00
parent bb857dcef2
commit 206b70c837

View File

@@ -547,6 +547,11 @@ out:
if (r < 0) {
crypt_free_volume_key(*vks);
*vks = NULL;
if (r == -ENOMEM)
log_err(cd, _("Not enough available memory to open a keyslot."));
else if (r != -EPERM)
log_err(cd, _("Keyslot open failed."));
}
return r;
}
@@ -579,6 +584,13 @@ int LUKS2_keyslot_open(struct crypt_device *cd,
} else
r = LUKS2_open_and_verify(cd, hdr, keyslot, segment, password, password_len, vk);
if (r < 0) {
if (r == -ENOMEM)
log_err(cd, _("Not enough available memory to open a keyslot."));
else if (r != -EPERM)
log_err(cd, _("Keyslot open failed."));
}
return r;
}