From f4bb2487d4942c60063e6985616ca5de2558195a Mon Sep 17 00:00:00 2001 From: Panu Matilainen Date: Fri, 5 Oct 2012 10:13:09 +0300 Subject: [PATCH] Avoid changing the dependency sets when adding to rpmal hash - Use indexed access to the dependencies so we're not mucking with the rpmds iterator index behind anybodys back, this could affect all sorts of things but miraculously nothing is hitting it atm... --- lib/rpmal.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/rpmal.c b/lib/rpmal.c index 232d8ba..63a70e2 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -5,7 +5,6 @@ #include "system.h" -#include #include #include #include @@ -13,6 +12,7 @@ #include "lib/rpmal.h" #include "lib/misc.h" #include "lib/rpmte_internal.h" +#include "lib/rpmds_internal.h" #include "debug.h" @@ -213,22 +213,23 @@ static void rpmalAddProvides(rpmal al, rpmalNum pkgNum, rpmds provides) struct availableIndexEntry_s indexEntry; rpm_color_t dscolor; int skipconf = (al->tsflags & RPMTRANS_FLAG_NOCONFIGS); + int dc = rpmdsCount(provides); indexEntry.pkgNum = pkgNum; - if (rpmdsInit(provides) != NULL) - while (rpmdsNext(provides) >= 0) { + for (int i = 0; i < dc; i++) { /* Ignore colored provides not in our rainbow. */ - dscolor = rpmdsColor(provides); + dscolor = rpmdsColorIndex(provides, i); if (al->tscolor && dscolor && !(al->tscolor & dscolor)) continue; /* Ignore config() provides if the files wont be installed */ - if (skipconf & (rpmdsFlags(provides) & RPMSENSE_CONFIG)) + if (skipconf & (rpmdsFlagsIndex(provides, i) & RPMSENSE_CONFIG)) continue; - indexEntry.entryIx = rpmdsIx(provides); - rpmalProvidesHashAddEntry(al->providesHash, rpmdsNId(provides), indexEntry); + indexEntry.entryIx = i;; + rpmalProvidesHashAddEntry(al->providesHash, + rpmdsNIdIndex(provides, i), indexEntry); } } -- 2.7.4