From: ewt Date: Mon, 26 Feb 1996 22:45:24 +0000 (+0000) Subject: checks the architecure before installing binary packages X-Git-Tag: tznext/4.11.0.1.tizen20130304~11533 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=fe37f884f1132b74693c591b25ea900c574e2a21;p=tools%2Flibrpm-tizen.git checks the architecure before installing binary packages CVS patchset: 427 CVS date: 1996/02/26 22:45:24 --- diff --git a/lib/install.c b/lib/install.c index e251d9d..b286000 100644 --- a/lib/install.c +++ b/lib/install.c @@ -103,6 +103,7 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags, dbIndexSet matches; int * oldVersions; int * intptr; + int_8 thisArch, pkgArch; oldVersions = alloca(sizeof(int)); *oldVersions = 0; @@ -125,16 +126,20 @@ int rpmInstallPackage(char * prefix, rpmdb db, int fd, int flags, return installSources(prefix, fd, NULL); } - /* we make a copy of the header here so we have one which we can add - entries to - though this shouldn't be necessary anymore XXX */ - h2 = copyHeader(h); - freeHeader(h); - h = h2; - getEntry(h, RPMTAG_NAME, &type, (void **) &name, &fileCount); getEntry(h, RPMTAG_VERSION, &type, (void **) &version, &fileCount); getEntry(h, RPMTAG_RELEASE, &type, (void **) &release, &fileCount); + /* make sure we're trying to install this on the proper architecture */ + thisArch = getArchNum(); + getEntry(h, RPMTAG_ARCH, &type, &pkgArch, &fileCount); + if (thisArch != pkgArch) { + error(RPMERR_BADARCH, "package %s-%s-%s is for a different " + "architecture", name, version, release); + freeHeader(h); + return 1; + } + if (labelFormat) { printf(labelFormat, name, version, release); fflush(stdout);