Fix error code in is_assigned#483
Conversation
The C function `crypt_token_is_assigned` returns a negative error code when the token is unassigned, but libc::ENOENT is positive.
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
1 similar comment
|
Congratulations! One of the builds has completed. 🍾 You can install the built RPMs by following these steps:
Please note that the RPMs should be used only in a testing environment. |
jbaublitz
left a comment
There was a problem hiding this comment.
I'm a little confused by this PR.
Here's what I found:
/**
* Get info about token assignment to particular keyslot.
*
* @param cd crypt device handle
* @param token token id
* @param keyslot keyslot
*
* @return @e 0 on success (token exists and is assigned to the keyslot),
* -ENOENT if token is not assigned to a keyslot (token, keyslot
* or both may be inactive) or other negative errno value otherwise.
*/
so the value should be negative. Based on libc docs this value is positive so the negative would need to be included in the comparison. Otherwise libcryptsetup would return -ENOENT (negative) which would be compared to libc::ENOENT (positive).
jbaublitz
left a comment
There was a problem hiding this comment.
Wow I have not had enough coffee today. I read the left as the change and not the current state of things. This is correct. I'll merge this.
The C function
crypt_token_is_assignedreturns-ENOENTwhen the token is unassigned.