mirror of
https://gitlab.com/cryptsetup/cryptsetup.git
synced 2025-12-17 13:50:06 +01:00
Fix return value in vk description parser.
Always return 0 on success or predefined negative errno otherwise.
This commit is contained in:
@@ -1629,13 +1629,10 @@ static int parse_vk_description(const char *key_description, char **ret_key_desc
|
|||||||
|
|
||||||
/* apply default key type */
|
/* apply default key type */
|
||||||
if (*key_description != '%')
|
if (*key_description != '%')
|
||||||
r = asprintf(&tmp, "%%user:%s", key_description);
|
r = asprintf(&tmp, "%%user:%s", key_description) < 0 ? -EINVAL : 0;
|
||||||
else {
|
else
|
||||||
tmp = strdup(key_description);
|
r = (tmp = strdup(key_description)) ? 0 : -ENOMEM;
|
||||||
r = tmp ? 0 : -ENOMEM;
|
if (!r)
|
||||||
}
|
|
||||||
|
|
||||||
if (r >= 0)
|
|
||||||
*ret_key_description = tmp;
|
*ret_key_description = tmp;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
|||||||
Reference in New Issue
Block a user