Fix LUKS2 encryption initialization with non-zero keyslot.

Positive keyslot number was interpreted as a failure.
This commit is contained in:
Ondrej Kozina
2019-11-08 12:58:28 +01:00
parent ba0ecc54df
commit 0a9e7028ae
2 changed files with 2 additions and 2 deletions

View File

@@ -1324,7 +1324,7 @@ static int _luksFormat(struct crypt_device **r_cd, char **r_password, size_t *r_
if (opt_integrity && !opt_integrity_no_wipe)
r = _wipe_data_device(cd);
out:
if (r == 0 && r_cd && r_password && r_passwordLen) {
if (r >= 0 && r_cd && r_password && r_passwordLen) {
*r_cd = cd;
*r_password = password;
*r_passwordLen = passwordLen;