This commit fixes the return checks for libcryptsetup functions
that may return non-zero success codes.
Fixes: https://tracker.ceph.com/issues/50461
Signed-off-by: Or Ozeri <oro@il.ibm.com>
auto r = crypt_keyslot_add_by_volume_key(
m_cd, CRYPT_ANY_SLOT, NULL, 0, passphrase, passphrase_size);
- if (r != 0) {
+ if (r < 0) {
lderr(m_cct) << "crypt_keyslot_add_by_volume_key failed: "
<< cpp_strerror(r) << dendl;
return r;
auto r = crypt_volume_key_get(
m_cd, CRYPT_ANY_SLOT, volume_key, volume_key_size, passphrase,
passphrase_size);
- if (r != 0) {
+ if (r < 0) {
lderr(m_cct) << "crypt_volume_key_get failed: " << cpp_strerror(r)
<< dendl;
return r;