Fix return value in vk description parser.

Always return 0 on success or predefined negative
errno otherwise.
This commit is contained in:
Ondrej Kozina
2023-10-03 15:13:58 +02:00
parent a5e2a97b53
commit 742bb0693d

View File

@@ -1629,13 +1629,10 @@ static int parse_vk_description(const char *key_description, char **ret_key_desc
/* apply default key type */
if (*key_description != '%')
r = asprintf(&tmp, "%%user:%s", key_description);
else {
tmp = strdup(key_description);
r = tmp ? 0 : -ENOMEM;
}
if (r >= 0)
r = asprintf(&tmp, "%%user:%s", key_description) < 0 ? -EINVAL : 0;
else
r = (tmp = strdup(key_description)) ? 0 : -ENOMEM;
if (!r)
*ret_key_description = tmp;
return r;