From 7570c91d88c95065d948e69db14aa0bf482718a9 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Tue, 1 Nov 2022 13:07:25 +0000 Subject: [PATCH] repos: Be more tolerant when keys are being used twice Signed-off-by: Michael Tremer --- src/libpakfire/repo.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/libpakfire/repo.c b/src/libpakfire/repo.c index 53f0c9999..c5276f845 100644 --- a/src/libpakfire/repo.c +++ b/src/libpakfire/repo.c @@ -127,7 +127,6 @@ static int pakfire_repo_retrieve( static int pakfire_repo_import_key(struct pakfire_repo* repo, FILE* f) { struct pakfire_key** keys = NULL; - size_t counter = 0; int r; // Import any keys from the file descriptor @@ -135,16 +134,11 @@ static int pakfire_repo_import_key(struct pakfire_repo* repo, FILE* f) { if (r) return r; - // Count how many keys were imported - for (struct pakfire_key** key = keys; *key; key++) - counter++; - - // We should only import one key - if (counter != 1) { - ERROR(repo->pakfire, "Imported %zu key(s) but expected one\n", counter); - r = 1; - goto ERROR; - } + /* + XXX It can happen, that more than one repository are using the same + key which can only be imported once. The second time, the key won't + be returned which lets us end up with that repository having no key. + */ for (struct pakfire_key** key = keys; *key; key++) { char* dump = pakfire_key_dump(*key); -- 2.39.5