[pacman-dev] [PATCH 2/2] libalpm: use else when setting fingerprint

Allan McRae allan at archlinux.org
Fri Jun 4 01:06:38 UTC 2021


On 4/6/21 6:39 am, morganamilo wrote:
> The docs [1] say keyid will always be there, so no need to check if it
> exists.
> 
> [1] https://www.gnupg.org/documentation/manuals/gpgme/Key-objects.html

I find the documentation vague.  From what I can tell, the lack of "if
present" in the description is determining that it is always there.

Saying that...  I don't think this will cause issues even if
"key->subkeys->keyid" is null.

Adding to my post-6.0.1 branch

> ---
>  lib/libalpm/signing.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/lib/libalpm/signing.c b/lib/libalpm/signing.c
> index bba4e991..443682b5 100644
> --- a/lib/libalpm/signing.c
> +++ b/lib/libalpm/signing.c
> @@ -350,7 +350,7 @@ static int key_search_keyserver(alpm_handle_t *handle, const char *fpr,
>  	pgpkey->data = key;
>  	if(key->subkeys->fpr) {
>  		pgpkey->fingerprint = key->subkeys->fpr;
> -	} else if(key->subkeys->keyid) {
> +	} else {
>  		pgpkey->fingerprint = key->subkeys->keyid;
>  	}
>  	pgpkey->uid = key->uids->uid;
> 


More information about the pacman-dev mailing list