From 49d9daa8d715550c1ed6c803d85cf5b273e06508 Mon Sep 17 00:00:00 2001 From: jbj Date: Wed, 1 Jan 2003 17:26:46 +0000 Subject: [PATCH] fix: file dependency dictionary has size other than #files. CVS patchset: 5992 CVS date: 2003/01/01 17:26:46 --- lib/rpmfi.c | 6 +++++- lib/transaction.c | 18 ++++++++++-------- 2 files changed, 15 insertions(+), 9 deletions(-) diff --git a/lib/rpmfi.c b/lib/rpmfi.c index f14e9be..f7d7e25 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -1176,7 +1176,11 @@ if (fi->actions == NULL) _fdupe(fi, fcolors); _fdupe(fi, fcdictx); - _fdupe(fi, ddict); + + if (fi->ddict != NULL) + fi->ddict = memcpy(xmalloc(fi->nddict * sizeof(*fi->ddict)), + fi->ddict, fi->nddict * sizeof(*fi->ddict)); + _fdupe(fi, fddictx); _fdupe(fi, fddictn); diff --git a/lib/transaction.c b/lib/transaction.c index 5c64688..bc3dc9e 100644 --- a/lib/transaction.c +++ b/lib/transaction.c @@ -161,7 +161,7 @@ static fileAction decideFileFate(const rpmts ts, if (oFLink && nFLink && !strcmp(oFLink, nFLink)) return FA_SKIP; /* identical file, don't bother. */ /*@=nullpass@*/ - } + } /* * The config file on the disk has been modified, but @@ -661,8 +661,8 @@ assert(otherFi != NULL); /*@=boundswrite@*/ /* Update disk space info for a file. */ - rpmtsUpdateDSI(ts, fiFps->entry->dev, - rpmfiFSize(fi), fi->replacedSizes[i], fixupSize, fi->actions[i]); + rpmtsUpdateDSI(ts, fiFps->entry->dev, rpmfiFSize(fi), + fi->replacedSizes[i], fixupSize, fi->actions[i]); } ps = rpmpsFree(ps); @@ -793,16 +793,16 @@ static void skipFiles(const rpmts ts, rpmfi fi) /* Don't bother with skipped files */ if (XFA_SKIPPING(fi->actions[i])) { - drc[ix]--; dff[ix] = 1; + drc[ix]--; dff[ix] = 1; continue; } /* Ignore colored files not in our rainbow. */ ficolor = rpmfiFColor(fi); - if (tscolor && ficolor && !(tscolor & ficolor)) { + if (tscolor && ficolor && !(tscolor & ficolor)) { drc[ix]--; dff[ix] = 1; fi->actions[i] = FA_SKIPCOLOR; - continue; + continue; } /* @@ -995,7 +995,9 @@ int rpmtsRun(rpmts ts, rpmps okProbs, rpmprobFilterFlags ignoreSet) int numRemoved; int xx; - /* FIXME: what if the same package is included in ts twice? */ + /* XXX programmer error segfault avoidance. */ + if (rpmtsNElements(ts) <= 0) + return -1; if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS) (void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers)); @@ -1387,7 +1389,7 @@ rpmMessage(RPMMESS_DEBUG, _("computing file dispositions\n")); 7, numRemoved, NULL, ts->notifyData)); NOTIFY(ts, (NULL, RPMCALLBACK_REPACKAGE_PROGRESS, progress, - numRemoved, NULL, ts->notifyData)); + numRemoved, NULL, ts->notifyData)); progress++; /* XXX TR_REMOVED needs CPIO_MAP_{ABSOLUTE,ADDDOT} CPIO_ALL_HARDLINKS */ -- 2.7.4