From: Panu Matilainen Date: Wed, 23 Mar 2011 10:13:25 +0000 (+0200) Subject: checkFreshenStatus() only needs a header, not the entire eiu struct X-Git-Tag: rpm-4.10.0-beta1~683 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=850fe79da6bdaef7fd228d2b314d51ceea24aff1;p=platform%2Fupstream%2Frpm.git checkFreshenStatus() only needs a header, not the entire eiu struct --- diff --git a/lib/rpminstall.c b/lib/rpminstall.c index 4e06133..9289030 100644 --- a/lib/rpminstall.c +++ b/lib/rpminstall.c @@ -351,11 +351,11 @@ static int tryReadHeader(rpmts ts, struct rpmEIU * eiu, rpmVSFlags vsflags) /* On --freshen, verify package is installed and newer */ -static int checkFreshenStatus(rpmts ts, struct rpmEIU * eiu) +static int checkFreshenStatus(rpmts ts, Header h) { rpmdbMatchIterator mi = NULL; - const char * name = headerGetString(eiu->h, RPMTAG_NAME); - const char *arch = headerGetString(eiu->h, RPMTAG_ARCH); + const char * name = headerGetString(h, RPMTAG_NAME); + const char *arch = headerGetString(h, RPMTAG_ARCH); Header oldH = NULL; if (name != NULL) @@ -365,15 +365,12 @@ static int checkFreshenStatus(rpmts ts, struct rpmEIU * eiu) while ((oldH = rpmdbNextIterator(mi)) != NULL) { /* Package is newer than those currently installed. */ - if (rpmVersionCompare(oldH, eiu->h) < 0) + if (rpmVersionCompare(oldH, h) < 0) break; } mi = rpmdbFreeIterator(mi); - if (oldH == NULL) { - eiu->h = headerFree(eiu->h); - } - return (oldH != NULL); + return (oldH != NULL); } /** @todo Generalize --freshen policies. */ @@ -541,8 +538,10 @@ restart: } if (ia->installInterfaceFlags & INSTALL_FRESHEN) - if (checkFreshenStatus(ts, eiu) != 1) + if (checkFreshenStatus(ts, eiu->h) != 1) { + eiu->h = headerFree(eiu->h); continue; + } rc = rpmtsAddInstallElement(ts, eiu->h, (fnpyKey)fileName, (ia->installInterfaceFlags & INSTALL_UPGRADE) != 0,