[Rpm-maint] [rpm-software-management/rpm] Use keyring to implement rpmkeys --list (PR #3369)

Panu Matilainen notifications at github.com
Fri Oct 11 06:26:45 UTC 2024


@pmatilai commented on this pull request.



> -	if (strncmp(*arg, "gpg-pubkey-", 11)) {
-	    char * gpgarg = NULL;
-	    rstrscat(&gpgarg, "gpg-pubkey-", *arg, NULL);
-	    argvAdd(&gpgargs, gpgarg);
-	    free(gpgarg);
-	} else {
-	    argvAdd(&gpgargs, *arg);
+static int matchingKeys(rpmKeyring keyring, ARGV_const_t args, void * userdata, int callback(rpmPubkey, void*))
+{
+    int ec = EXIT_SUCCESS;
+    if (args) {
+	for (char * const * arg = args; *arg; arg++) {
+	    int found = false;
+	    auto iter = rpmKeyringInitIterator(keyring, 0);
+	    rpmPubkey key = rpmKeyringIteratorNext(iter);
+	    while (key) {

Just do

```
while ((key = rpmKeyringIteartorNext(iter))) {
    ...
}
```

That avoids having to call it twice - and is what everything else in the codebase does.

-- 
Reply to this email directly or view it on GitHub:
https://github.com/rpm-software-management/rpm/pull/3369#pullrequestreview-2362041437
You are receiving this because you are subscribed to this thread.

Message ID: <rpm-software-management/rpm/pull/3369/review/2362041437 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rpm.org/pipermail/rpm-maint/attachments/20241010/25d828b2/attachment.html>


More information about the Rpm-maint mailing list