summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/.lclintrc20
-rw-r--r--lib/Makefile.am4
-rw-r--r--lib/db1.c23
-rw-r--r--lib/db3.c4
-rw-r--r--lib/depends.c62
-rw-r--r--lib/falloc.c8
-rw-r--r--lib/formats.c18
-rw-r--r--lib/fprint.c19
-rw-r--r--lib/fs.c4
-rw-r--r--lib/fsm.c4
-rw-r--r--lib/getdate.c166
-rw-r--r--lib/header.c11
-rw-r--r--lib/md5sum.c4
-rw-r--r--lib/misc.c67
-rw-r--r--lib/package.c15
-rw-r--r--lib/problems.c26
-rw-r--r--lib/psm.c168
-rw-r--r--lib/query.c69
-rw-r--r--lib/rpmchecksig.c35
-rw-r--r--lib/rpmdb.c89
-rw-r--r--lib/rpminstall.c48
-rw-r--r--lib/rpmrc.c8
-rw-r--r--lib/signature.c164
-rw-r--r--lib/transaction.c78
-rw-r--r--lib/verify.c132
25 files changed, 643 insertions, 603 deletions
diff --git a/lib/.lclintrc b/lib/.lclintrc
index 98a171fe1..7aa8dd046 100644
--- a/lib/.lclintrc
+++ b/lib/.lclintrc
@@ -11,22 +11,16 @@
-unrecogcomments
# don't-bother-me-yet parameters
--branchstate # ~142 occurences, painful
-#-immediatetrans
--mustfree # ~529 alloca is painful
-#-observertrans
-#-statictrans
+-branchstate # ~140 painful
+-mustfree # ~588 alloca is painful
# not-yet normal parameters
--boolops # w->n
-#-fixedformalarray # md5 whines
--null
--predboolint # w->n
-#-predboolothers # w->n
--retvalint # w->n
--type
+-boolops # ~831 w->n
+#-null # ~267
+-predboolint # ~576 w->n
+-type # ~872
-# not-yet -weak paramaters
+# -weak paramaters
#+boolint
#-boolops
#+ignorequals
diff --git a/lib/Makefile.am b/lib/Makefile.am
index e3ea50581..f68c13693 100644
--- a/lib/Makefile.am
+++ b/lib/Makefile.am
@@ -57,9 +57,9 @@ getdate.c: getdate.y
@echo expect 10 shift/reduce conflicts
$(YACC) $(srcdir)/getdate.y
-@if test -f y.tab.c; then \
- { echo "/*@-unqualifiedtrans -usedef -varuse -globstate@*/";\
+ { echo "/*@-globstate -retvalint -unqualifiedtrans -usedef -varuse@*/";\
cat y.tab.c ;\
- echo "/*@=unqualifiedtrans =usedef =varuse =globstate@*/";\
+ echo "/*@=globstate =retvalint =unqualifiedtrans =usedef =varuse@*/";\
} > getdate.c ;\
rm -f y.tab.c; \
else \
diff --git a/lib/db1.c b/lib/db1.c
index b9c4e76d1..4bc7d4ec2 100644
--- a/lib/db1.c
+++ b/lib/db1.c
@@ -16,8 +16,8 @@ static int _debug = 1; /* XXX if < 0 debugging, > 0 unusual error returns */
#endif
#endif
-#define DB_VERSION_MAJOR 0
-#define DB_VERSION_MINOR 0
+#define DB_VERSION_MAJOR 1
+#define DB_VERSION_MINOR 85
#define DB_VERSION_PATCH 0
#define _mymemset(_a, _b, _c)
@@ -145,6 +145,16 @@ static void * doGetRecord(FD_t pkgs, unsigned int offset)
h = headerRead(pkgs, HEADER_MAGIC_NO);
+ /* let's sanity check this record a bit, otherwise just skip it */
+ if (!(headerIsEntry(h, RPMTAG_NAME) &&
+ headerIsEntry(h, RPMTAG_VERSION) &&
+ headerIsEntry(h, RPMTAG_RELEASE) &&
+ headerIsEntry(h, RPMTAG_BUILDTIME)))
+ {
+ headerFree(h);
+ h = NULL;
+ }
+
if (h == NULL)
goto exit;
@@ -184,7 +194,7 @@ static void * doGetRecord(FD_t pkgs, unsigned int offset)
free(fileNames);
- headerModifyEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerModifyEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
newFileNames, fileCount);
}
@@ -269,8 +279,11 @@ static int db1cget(dbiIndex dbi, /*@unused@*/ DBC * dbcursor, void ** keyp,
} else { /* XXX simulated retrieval */
data.data = doGetRecord(pkgs, offset);
data.size = 0; /* XXX WRONG */
- if (data.data == NULL)
+ if (data.data == NULL) {
+if (keyp) *keyp = key.data;
+if (keylen) *keylen = key.size;
rc = EFAULT;
+ }
}
} else {
DB * db;
@@ -484,7 +497,7 @@ exit:
dbi->dbi_vec = &db1vec;
*dbip = dbi;
} else
- db1close(dbi, 0);
+ (void) db1close(dbi, 0);
base = _free(base);
urlfn = _free(urlfn);
diff --git a/lib/db3.c b/lib/db3.c
index d85a5613f..14dd3094f 100644
--- a/lib/db3.c
+++ b/lib/db3.c
@@ -565,7 +565,7 @@ static int db3close(/*@only@*/ dbiIndex dbi, /*@unused@*/ unsigned int flags)
#if defined(__USE_DB2) || defined(__USE_DB3)
if (dbi->dbi_rmw)
- db3cclose(dbi, NULL, 0);
+ rc = db3cclose(dbi, NULL, 0);
if (db) {
rc = db->close(db, 0);
@@ -834,7 +834,7 @@ static int db3open(/*@keep@*/ rpmdb rpmdb, int rpmtag, dbiIndex * dbip)
dbi->dbi_vec = &db3vec;
*dbip = dbi;
} else
- db3close(dbi, 0);
+ (void) db3close(dbi, 0);
urlfn = _free(urlfn);
diff --git a/lib/depends.c b/lib/depends.c
index f52e9d984..e9a26f1e8 100644
--- a/lib/depends.c
+++ b/lib/depends.c
@@ -259,7 +259,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
memset(&p->tsi, 0, sizeof(p->tsi));
p->multiLib = 0; /* MULTILIB */
- headerNVR(p->h, &p->name, &p->version, &p->release);
+ (void) headerNVR(p->h, &p->name, &p->version, &p->release);
/* XXX This should be added always so that packages look alike.
* XXX However, there is logic in files.c/depends.c that checks for
@@ -275,7 +275,7 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
(void **) &pp, NULL)
&& !rpmVersionCompare(p->h, al->list[i].h)
&& *pp && !(*pp & multiLibMask))
- p->multiLib = multiLibMask;
+ p->multiLib = multiLibMask;
}
}
@@ -312,14 +312,14 @@ static /*@exposed@*/ struct availablePackage * alAddPackage(struct availableList
p->requireFlags = NULL;
}
- if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &p->baseNames, &p->filesCount))
+ if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **)&p->baseNames, &p->filesCount))
{
p->filesCount = 0;
p->baseNames = NULL;
} else {
- hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs);
- hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
- hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, &numDirs);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlags, NULL);
/* XXX FIXME: We ought to relocate the directory list here */
@@ -608,7 +608,6 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req
int_32 * provideFlags;
int providesCount;
int result;
- int type;
int i;
if (!(reqFlags & RPMSENSE_SENSEMASK) || !reqEVR || !strlen(reqEVR))
@@ -623,7 +622,7 @@ static int rangeMatchesDepFlags (Header h, const char *reqName, const char * req
(void **) &providesEVR, &providesCount))
return 1;
- hge(h, RPMTAG_PROVIDEFLAGS, &type, (void **) &provideFlags, &providesCount);
+ (void) hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount))
{
@@ -666,7 +665,7 @@ int headerMatchesDepFlags(Header h,
return 1;
/* Get package information from header */
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
pkgEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
*p = '\0';
@@ -789,7 +788,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
if (headerIsEntry(h, RPMTAG_SOURCEPACKAGE))
return 0;
- headerNVR(h, &name, NULL, NULL);
+ (void) headerNVR(h, &name, NULL, NULL);
{ rpmdbMatchIterator mi;
Header h2;
@@ -815,12 +814,14 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
}
if (hge(h, RPMTAG_OBSOLETENAME, &ont, (void **) &obsoletes, &count)) {
- const char **obsoletesEVR;
- int_32 *obsoletesFlags;
+ const char ** obsoletesEVR;
+ int_32 * obsoletesFlags;
int j;
- hge(h, RPMTAG_OBSOLETEVERSION, &ovt, (void **) &obsoletesEVR, NULL);
- hge(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags, NULL);
+ (void) hge(h, RPMTAG_OBSOLETEVERSION, &ovt, (void **) &obsoletesEVR,
+ NULL);
+ (void) hge(h, RPMTAG_OBSOLETEFLAGS, NULL, (void **) &obsoletesFlags,
+ NULL);
for (j = 0; j < count; j++) {
@@ -833,7 +834,7 @@ int rpmtransAddPackage(rpmTransactionSet ts, Header h, FD_t fd,
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, obsoletes[j], 0);
- rpmdbPruneIterator(mi,
+ (void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while((h2 = rpmdbNextIterator(mi)) != NULL) {
@@ -1114,7 +1115,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_BASENAMES, keyName, 0);
- rpmdbPruneIterator(mi,
+ (void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
@@ -1127,7 +1128,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
}
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_PROVIDENAME, keyName, 0);
- rpmdbPruneIterator(mi,
+ (void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (rangeMatchesDepFlags(h, keyName, keyEVR, keyFlags)) {
@@ -1141,7 +1142,7 @@ static int unsatisfiedDepend(rpmTransactionSet ts,
#ifndef DYING
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, keyName, 0);
- rpmdbPruneIterator(mi,
+ (void) rpmdbPruneIterator(mi,
ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (rangeMatchesDepFlags(h, keyName, keyEVR, keyFlags)) {
@@ -1213,17 +1214,15 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
int ourrc = 0;
struct availablePackage * suggestion;
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
if (!hge(h, RPMTAG_REQUIRENAME, &rnt, (void **) &requires, &requiresCount))
{
requiresCount = 0;
rvt = RPM_STRING_ARRAY_TYPE;
} else {
- hge(h, RPMTAG_REQUIREFLAGS, &type, (void **) &requireFlags,
- &requiresCount);
- hge(h, RPMTAG_REQUIREVERSION, &rvt,
- (void **) &requiresEVR, &requiresCount);
+ (void)hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **) &requireFlags, NULL);
+ (void)hge(h, RPMTAG_REQUIREVERSION, &rvt, (void **) &requiresEVR, NULL);
}
for (i = 0; i < requiresCount && !ourrc; i++) {
@@ -1289,9 +1288,9 @@ static int checkPackageDeps(rpmTransactionSet ts, struct problemsSet * psp,
conflictsCount = 0;
cvt = RPM_STRING_ARRAY_TYPE;
} else {
- hge(h, RPMTAG_CONFLICTFLAGS, &type,
+ (void) hge(h, RPMTAG_CONFLICTFLAGS, &type,
(void **) &conflictFlags, &conflictsCount);
- hge(h, RPMTAG_CONFLICTVERSION, &cvt,
+ (void) hge(h, RPMTAG_CONFLICTVERSION, &cvt,
(void **) &conflictsEVR, &conflictsCount);
}
@@ -1363,7 +1362,8 @@ static int checkPackageSet(rpmTransactionSet ts, struct problemsSet * psp,
Header h;
int rc = 0;
- rpmdbPruneIterator(mi, ts->removedPackages, ts->numRemovedPackages, 1);
+ (void) rpmdbPruneIterator(mi,
+ ts->removedPackages, ts->numRemovedPackages, 1);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (checkPackageDeps(ts, psp, h, key, 0)) {
rc = 1;
@@ -1972,11 +1972,12 @@ int rpmdepCheck(rpmTransactionSet ts,
*/
if (ts->numRemovedPackages > 0) {
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
- rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages);
+ (void) rpmdbAppendIterator(mi,
+ ts->removedPackages, ts->numRemovedPackages);
while ((h = rpmdbNextIterator(mi)) != NULL) {
{ const char * name, * version, * release;
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
rpmMessage(RPMMESS_DEBUG, ("========== --- %s-%s-%s\n"),
name, version, release);
@@ -2016,8 +2017,9 @@ int rpmdepCheck(rpmTransactionSet ts,
if (hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount))
{
- hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
- hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes,
+ NULL);
rc = 0;
for (j = 0; j < fileCount; j++) {
len = strlen(baseNames[j]) + 1 +
diff --git a/lib/falloc.c b/lib/falloc.c
index 55387c623..c882079ea 100644
--- a/lib/falloc.c
+++ b/lib/falloc.c
@@ -76,7 +76,7 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
newHdr.magic = FA_MAGIC;
newHdr.firstFree = 0;
if (Fwrite(&newHdr, sizeof(char), sizeof(newHdr), fd) != sizeof(newHdr)) {
- Fclose(fd);
+ (void) Fclose(fd);
return NULL;
}
fadSetFirstFree(fd, 0);
@@ -84,18 +84,18 @@ FD_t fadOpen(const char * path, int flags, mode_t perms)
} else {
memset(&newHdr, 0, sizeof(newHdr));
if (Pread(fd, &newHdr, sizeof(newHdr), 0) != sizeof(newHdr)) {
- Fclose(fd);
+ (void) Fclose(fd);
return NULL;
}
if (newHdr.magic != FA_MAGIC) {
- Fclose(fd);
+ (void) Fclose(fd);
return NULL;
}
fadSetFirstFree(fd, newHdr.firstFree);
fadSetFileSize(fd, Fseek(fd, 0, SEEK_END));
if (fadGetFileSize(fd) < 0) {
- Fclose(fd);
+ (void) Fclose(fd);
return NULL;
}
}
diff --git a/lib/formats.c b/lib/formats.c
index 43c35804d..97a58d4f2 100644
--- a/lib/formats.c
+++ b/lib/formats.c
@@ -280,10 +280,10 @@ static int triggercondsTag(Header h, /*@out@*/ int_32 * type,
return 0;
}
- hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL);
- hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
- hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL);
- hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
+ (void) hge(h, RPMTAG_TRIGGERINDEX, NULL, (void **) &indices, NULL);
+ (void) hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
+ (void) hge(h, RPMTAG_TRIGGERVERSION, &tvt, (void **) &versions, NULL);
+ (void) hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
s = hfd(s, tst);
*freeData = 1;
@@ -348,8 +348,8 @@ static int triggertypeTag(Header h, /*@out@*/ int_32 * type,
return 1;
}
- hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
- hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
+ (void) hge(h, RPMTAG_TRIGGERFLAGS, NULL, (void **) &flags, NULL);
+ (void) hge(h, RPMTAG_TRIGGERSCRIPTS, &tst, (void **) &s, &numScripts);
s = hfd(s, tst);
*freeData = 1;
@@ -435,7 +435,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
{ const char * tn = tagName(tag);
const char * n;
char * mk;
- headerNVR(h, &n, NULL, NULL);
+ (void) headerNVR(h, &n, NULL, NULL);
mk = alloca(strlen(n) + strlen(tn) + sizeof("()"));
sprintf(mk, "%s(%s)", n, tn);
msgkey = mk;
@@ -443,7 +443,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
/* change to en_US for msgkey -> msgid resolution */
langval = getenv(language);
- setenv(language, "en_US", 1);
+ (void) setenv(language, "en_US", 1);
++_nl_msg_cat_cntr;
msgid = NULL;
@@ -456,7 +456,7 @@ static int i18nTag(Header h, int_32 tag, /*@out@*/ int_32 * type,
/* restore previous environment for msgid -> msgstr resolution */
if (langval)
- setenv(language, langval, 1);
+ (void) setenv(language, langval, 1);
else
unsetenv(language);
++_nl_msg_cat_cntr;
diff --git a/lib/fprint.c b/lib/fprint.c
index 930af90b3..a5f5a1cb9 100644
--- a/lib/fprint.c
+++ b/lib/fprint.c
@@ -228,18 +228,19 @@ void fpLookupList(fingerPrintCache cache, const char ** dirNames,
void fpLookupHeader(fingerPrintCache cache, Header h, fingerPrint * fpList)
{
- int fileCount;
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+ HFD_t hfd = headerFreeData;
const char ** baseNames, ** dirNames;
+ int bnt, dnt;
int_32 * dirIndexes;
+ int fileCount;
- if (!headerGetEntryMinMemory(h, RPMTAG_BASENAMES, NULL,
- (const void **) &baseNames, &fileCount)) return;
+ if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &fileCount))
+ return;
- headerGetEntryMinMemory(h, RPMTAG_DIRNAMES, NULL,
- (const void **) &dirNames, NULL);
- headerGetEntryMinMemory(h, RPMTAG_DIRINDEXES, NULL,
- (const void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
fpLookupList(cache, dirNames, baseNames, dirIndexes, fileCount, fpList);
- free(dirNames);
- free(baseNames);
+ dirNames = hfd(dirNames, dnt);
+ baseNames = hfd(baseNames, bnt);
}
diff --git a/lib/fs.c b/lib/fs.c
index 862f9d9a0..d7e2ec6f0 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -204,9 +204,9 @@ static int getFilesystemList(void)
}
# if GETMNTENT_ONE || GETMNTENT_TWO
- fclose(mtab);
+ (void) fclose(mtab);
# elif HAVE_GETMNTINFO_R
- free(mounts);
+ mounts = _free(mounts);
# endif
filesystems[numFilesystems].dev = 0;
diff --git a/lib/fsm.c b/lib/fsm.c
index 8391b932a..dbe404c4d 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -648,7 +648,7 @@ static int expandRegular(FSM_t fsm)
if (st->st_size > 0 && fmd5sum) {
const char * md5sum = NULL;
- Fflush(fsm->wfd);
+ (void) Fflush(fsm->wfd);
fdFiniMD5(fsm->wfd, (void **)&md5sum, NULL, 1);
if (md5sum == NULL) {
@@ -761,7 +761,7 @@ static int writeFile(FSM_t fsm, int writeData)
#if HAVE_MMAP
if (mapped != (void *)-1) {
- /*@-noeffect@*/ munmap(mapped, nmapped) /*@=noeffect@*/;
+ /*@-noeffect@*/ (void) munmap(mapped, nmapped) /*@=noeffect@*/;
fsm->rdbuf = rdbuf;
}
#endif
diff --git a/lib/getdate.c b/lib/getdate.c
index 296788eef..d1dbf8f75 100644
--- a/lib/getdate.c
+++ b/lib/getdate.c
@@ -1,3 +1,4 @@
+/*@-globstate -retvalint -unqualifiedtrans -usedef -varuse@*/
#ifndef lint
static char const
yyrcsid[] = "$FreeBSD: src/usr.bin/yacc/skeleton.c,v 1.28 2000/01/17 02:04:06 bde Exp $";
@@ -123,15 +124,20 @@ struct timeb {
unportable getdate.c's), but that seems to cause as many problems
as it solves. */
+#if 0
extern struct tm *gmtime();
extern struct tm *localtime();
+#endif
+
+extern time_t get_date(char * p, struct timeb * now);
#define yyparse getdate_yyparse
#define yylex getdate_yylex
#define yyerror getdate_yyerror
-static int yylex ();
-static int yyerror ();
+static int yyparse (void);
+static int yylex (void);
+static int yyerror(const char * s);
#define EPOCH 1970
#define HOUR(x) ((time_t)(x) * 60)
@@ -189,12 +195,12 @@ static MERIDIAN yyMeridian;
static time_t yyRelMonth;
static time_t yyRelSeconds;
-#line 179 "./getdate.y"
+#line 184 "./getdate.y"
typedef union {
time_t Number;
enum _MERIDIAN Meridian;
} YYSTYPE;
-#line 198 "y.tab.c"
+#line 203 "y.tab.c"
#define YYERRCODE 256
#define tAGO 257
#define tDAY 258
@@ -412,7 +418,7 @@ short *yyss;
short *yysslim;
YYSTYPE *yyvs;
int yystacksize;
-#line 398 "./getdate.y"
+#line 403 "./getdate.y"
/* Month and day table. */
static TABLE const MonthDayTable[] = {
@@ -440,7 +446,7 @@ static TABLE const MonthDayTable[] = {
{ "thurs", tDAY, 4 },
{ "friday", tDAY, 5 },
{ "saturday", tDAY, 6 },
- { NULL }
+ { NULL, 0, 0 }
};
/* Time units table. */
@@ -455,7 +461,7 @@ static TABLE const UnitsTable[] = {
{ "min", tMINUTE_UNIT, 1 },
{ "second", tSEC_UNIT, 1 },
{ "sec", tSEC_UNIT, 1 },
- { NULL }
+ { NULL, 0, 0 }
};
/* Assorted relative-time words. */
@@ -480,7 +486,7 @@ static TABLE const OtherTable[] = {
{ "eleventh", tUNUMBER, 11 },
{ "twelfth", tUNUMBER, 12 },
{ "ago", tAGO, 1 },
- { NULL }
+ { NULL, 0, 0 }
};
/* The timezone table. */
@@ -565,7 +571,7 @@ static TABLE const TimezoneTable[] = {
{ "nzst", tZONE, -HOUR(12) }, /* New Zealand Standard */
{ "nzdt", tDAYZONE, -HOUR(12) }, /* New Zealand Daylight */
{ "idle", tZONE, -HOUR(12) }, /* International Date Line East */
- { NULL }
+ { NULL, 0, 0 }
};
/* Military timezone table. */
@@ -595,7 +601,7 @@ static TABLE const MilitaryTable[] = {
{ "x", tZONE, HOUR(-11) },
{ "y", tZONE, HOUR(-12) },
{ "z", tZONE, HOUR( 0) },
- { NULL }
+ { NULL, 0, 0 }
};
@@ -603,19 +609,14 @@ static TABLE const MilitaryTable[] = {
/* ARGSUSED */
static int
-yyerror(s)
- char *s;
+yyerror(const char * s)
{
return 0;
}
static time_t
-ToSeconds(Hours, Minutes, Seconds, Meridian)
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
+ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
{
if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 59)
return -1;
@@ -648,15 +649,9 @@ ToSeconds(Hours, Minutes, Seconds, Meridian)
* A number from 0 to 99, which means a year from 1900 to 1999, or
* The actual year (>=100). */
static time_t
-Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
- time_t Month;
- time_t Day;
- time_t Year;
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
- DSTMODE DSTmode;
+Convert(time_t Month, time_t Day, time_t Year,
+ time_t Hours, time_t Minutes, time_t Seconds,
+ MERIDIAN Meridian, DSTMODE DSTmode)
{
static int DaysInMonth[12] = {
31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
@@ -698,9 +693,7 @@ Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, DSTmode)
static time_t
-DSTcorrect(Start, Future)
- time_t Start;
- time_t Future;
+DSTcorrect(time_t Start, time_t Future)
{
time_t StartDay;
time_t FutureDay;
@@ -712,10 +705,7 @@ DSTcorrect(Start, Future)
static time_t
-RelativeDate(Start, DayOrdinal, DayNumber)
- time_t Start;
- time_t DayOrdinal;
- time_t DayNumber;
+RelativeDate(time_t Start, time_t DayOrdinal, time_t DayNumber)
{
struct tm *tm;
time_t now;
@@ -729,9 +719,7 @@ RelativeDate(Start, DayOrdinal, DayNumber)
static time_t
-RelativeMonth(Start, RelMonth)
- time_t Start;
- time_t RelMonth;
+RelativeMonth(time_t Start, time_t RelMonth)
{
struct tm *tm;
time_t Month;
@@ -751,8 +739,7 @@ RelativeMonth(Start, RelMonth)
static int
-LookupWord(buff)
- char *buff;
+LookupWord(char * buff)
{
register char *p;
register char *q;
@@ -761,7 +748,7 @@ LookupWord(buff)
int abbrev;
/* Make it lowercase. */
- for (p = buff; *p; p++)
+ for (p = buff; *p != '\0'; p++)
if (isupper(*p))
*p = tolower(*p);
@@ -840,7 +827,7 @@ LookupWord(buff)
}
/* Drop out any periods and try the timezone table again. */
- for (i = 0, p = q = buff; *q; q++)
+ for (i = 0, p = q = buff; *q != '\0'; q++)
if (*q != '.')
*p++ = *q;
else
@@ -858,7 +845,7 @@ LookupWord(buff)
static int
-yylex()
+yylex(void)
{
register char c;
register char *p;
@@ -907,17 +894,18 @@ yylex()
Count--;
} while (Count > 0);
}
+ /*@notreached@*/
+ return 0;
}
#define TM_YEAR_ORIGIN 1900
/* Yield A - B, measured in seconds. */
static long
-difftm (a, b)
- struct tm *a, *b;
+difftm (const struct tm * a, const struct tm * b)
{
- int ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
- int by = b->tm_year + (TM_YEAR_ORIGIN - 1);
+ unsigned ay = a->tm_year + (TM_YEAR_ORIGIN - 1);
+ unsigned by = b->tm_year + (TM_YEAR_ORIGIN - 1);
int days = (
/* difference in day of year */
a->tm_yday - b->tm_yday
@@ -934,9 +922,7 @@ difftm (a, b)
}
time_t
-get_date(p, now)
- char *p;
- struct timeb *now;
+get_date(char * p, struct timeb * now)
{
struct tm *tm, gmt;
struct timeb ftz;
@@ -945,6 +931,7 @@ get_date(p, now)
time_t nowtime;
yyInput = p;
+ memset(&gmt, 0, sizeof(gmt));
if (now == NULL) {
struct tm *gmt_ptr;
@@ -965,7 +952,9 @@ get_date(p, now)
return -1;
if (gmt_ptr != NULL)
+ /*@-observertrans -dependenttrans@*/
ftz.timezone = difftm (&gmt, tm) / 60;
+ /*@=observertrans =dependenttrans@*/
else
/* We are on a system like VMS, where the system clock is
in local time and the system has no concept of timezones.
@@ -1000,9 +989,11 @@ get_date(p, now)
yyHaveTime = 0;
yyHaveZone = 0;
+ /*@-unrecog@*/
if (yyparse()
|| yyHaveTime > 1 || yyHaveZone > 1 || yyHaveDate > 1 || yyHaveDay > 1)
return -1;
+ /*@=unrecog@*/
if (yyHaveDate || yyHaveTime || yyHaveDay) {
Start = Convert(yyMonth, yyDay, yyYear, yyHour, yyMinutes, yySeconds,
@@ -1056,7 +1047,7 @@ main(ac, av)
/* NOTREACHED */
}
#endif /* defined(TEST) */
-#line 1060 "y.tab.c"
+#line 1050 "y.tab.c"
/* allocate initial stack or double stack size, up to YYMAXDEPTH */
static int yygrowstack()
{
@@ -1252,37 +1243,37 @@ yyreduce:
switch (yyn)
{
case 3:
-#line 197 "./getdate.y"
+#line 202 "./getdate.y"
{
yyHaveTime++;
}
break;
case 4:
-#line 200 "./getdate.y"
+#line 205 "./getdate.y"
{
yyHaveZone++;
}
break;
case 5:
-#line 203 "./getdate.y"
+#line 208 "./getdate.y"
{
yyHaveDate++;
}
break;
case 6:
-#line 206 "./getdate.y"
+#line 211 "./getdate.y"
{
yyHaveDay++;
}
break;
case 7:
-#line 209 "./getdate.y"
+#line 214 "./getdate.y"
{
yyHaveRel++;
}
break;
case 9:
-#line 215 "./getdate.y"
+#line 220 "./getdate.y"
{
yyHour = yyvsp[-1].Number;
yyMinutes = 0;
@@ -1291,7 +1282,7 @@ case 9:
}
break;
case 10:
-#line 221 "./getdate.y"
+#line 226 "./getdate.y"
{
yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number;
@@ -1300,7 +1291,7 @@ case 10:
}
break;
case 11:
-#line 227 "./getdate.y"
+#line 232 "./getdate.y"
{
yyHour = yyvsp[-3].Number;
yyMinutes = yyvsp[-1].Number;
@@ -1310,7 +1301,7 @@ case 11:
}
break;
case 12:
-#line 234 "./getdate.y"
+#line 239 "./getdate.y"
{
yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number;
@@ -1319,7 +1310,7 @@ case 12:
}
break;
case 13:
-#line 240 "./getdate.y"
+#line 245 "./getdate.y"
{
yyHour = yyvsp[-5].Number;
yyMinutes = yyvsp[-3].Number;
@@ -1330,56 +1321,56 @@ case 13:
}
break;
case 14:
-#line 250 "./getdate.y"
+#line 255 "./getdate.y"
{
yyTimezone = yyvsp[0].Number;
yyDSTmode = DSToff;
}
break;
case 15:
-#line 254 "./getdate.y"
+#line 259 "./getdate.y"
{
yyTimezone = yyvsp[0].Number;
yyDSTmode = DSTon;
}
break;
case 16:
-#line 259 "./getdate.y"
+#line 264 "./getdate.y"
{
yyTimezone = yyvsp[-1].Number;
yyDSTmode = DSTon;
}
break;
case 17:
-#line 265 "./getdate.y"
+#line 270 "./getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = yyvsp[0].Number;
}
break;
case 18:
-#line 269 "./getdate.y"
+#line 274 "./getdate.y"
{
yyDayOrdinal = 1;
yyDayNumber = yyvsp[-1].Number;
}
break;
case 19:
-#line 273 "./getdate.y"
+#line 278 "./getdate.y"
{
yyDayOrdinal = yyvsp[-1].Number;
yyDayNumber = yyvsp[0].Number;
}
break;
case 20:
-#line 279 "./getdate.y"
+#line 284 "./getdate.y"
{
yyMonth = yyvsp[-2].Number;
yyDay = yyvsp[0].Number;
}
break;
case 21:
-#line 283 "./getdate.y"
+#line 288 "./getdate.y"
{
if (yyvsp[-4].Number >= 100) {
yyYear = yyvsp[-4].Number;
@@ -1393,7 +1384,7 @@ case 21:
}
break;
case 22:
-#line 294 "./getdate.y"
+#line 299 "./getdate.y"
{
/* ISO 8601 format. yyyy-mm-dd. */
yyYear = yyvsp[-2].Number;
@@ -1402,7 +1393,7 @@ case 22:
}
break;
case 23:
-#line 300 "./getdate.y"
+#line 305 "./getdate.y"
{
/* e.g. 17-JUN-1992. */
yyDay = yyvsp[-2].Number;
@@ -1411,14 +1402,14 @@ case 23:
}
break;
case 24:
-#line 306 "./getdate.y"
+#line 311 "./getdate.y"
{
yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[0].Number;
}
break;
case 25:
-#line 310 "./getdate.y"
+#line 315 "./getdate.y"
{
yyMonth = yyvsp[-3].Number;
yyDay = yyvsp[-2].Number;
@@ -1426,14 +1417,14 @@ case 25:
}
break;
case 26:
-#line 315 "./getdate.y"
+#line 320 "./getdate.y"
{
yyMonth = yyvsp[0].Number;
yyDay = yyvsp[-1].Number;
}
break;
case 27:
-#line 319 "./getdate.y"
+#line 324 "./getdate.y"
{
yyMonth = yyvsp[-1].Number;
yyDay = yyvsp[-2].Number;
@@ -1441,68 +1432,68 @@ case 27:
}
break;
case 28:
-#line 326 "./getdate.y"
+#line 331 "./getdate.y"
{
yyRelSeconds = -yyRelSeconds;
yyRelMonth = -yyRelMonth;
}
break;
case 30:
-#line 333 "./getdate.y"
+#line 338 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
}
break;
case 31:
-#line 336 "./getdate.y"
+#line 341 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number * yyvsp[0].Number * 60L;
}
break;
case 32:
-#line 339 "./getdate.y"
+#line 344 "./getdate.y"
{
yyRelSeconds += yyvsp[0].Number * 60L;
}
break;
case 33:
-#line 342 "./getdate.y"
+#line 347 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number;
}
break;
case 34:
-#line 345 "./getdate.y"
+#line 350 "./getdate.y"
{
yyRelSeconds += yyvsp[-1].Number;
}
break;
case 35:
-#line 348 "./getdate.y"
+#line 353 "./getdate.y"
{
yyRelSeconds++;
}
break;
case 36:
-#line 351 "./getdate.y"
+#line 356 "./getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
}
break;
case 37:
-#line 354 "./getdate.y"
+#line 359 "./getdate.y"
{
yyRelMonth += yyvsp[-1].Number * yyvsp[0].Number;
}
break;
case 38:
-#line 357 "./getdate.y"
+#line 362 "./getdate.y"
{
yyRelMonth += yyvsp[0].Number;
}
break;
case 39:
-#line 362 "./getdate.y"
+#line 367 "./getdate.y"
{
if (yyHaveTime && yyHaveDate && !yyHaveRel)
yyYear = yyvsp[0].Number;
@@ -1530,18 +1521,18 @@ case 39:
}
break;
case 40:
-#line 389 "./getdate.y"
+#line 394 "./getdate.y"
{
yyval.Meridian = MER24;
}
break;
case 41:
-#line 392 "./getdate.y"
+#line 397 "./getdate.y"
{
yyval.Meridian = yyvsp[0].Meridian;
}
break;
-#line 1545 "y.tab.c"
+#line 1535 "y.tab.c"
}
yyssp -= yym;
yystate = *yyssp;
@@ -1598,3 +1589,4 @@ yyabort:
yyaccept:
return (0);
}
+/*@=globstate =retvalint =unqualifiedtrans =usedef =varuse@*/
diff --git a/lib/header.c b/lib/header.c
index 6f2450540..3019e7c61 100644
--- a/lib/header.c
+++ b/lib/header.c
@@ -481,7 +481,7 @@ Header headerCopy(Header h)
headerNextIterator(hi, &tag, &type, &ptr, &count);
ptr = headerFreeData((void *)ptr, type))
{
- headerAddEntry(nh, tag, type, ptr, count);
+ (void) headerAddEntry(nh, tag, type, ptr, count);
}
headerFreeIterator(hi);
@@ -595,9 +595,9 @@ assert(rdlen == dl);
/* Dribble entries replace duplicate region entries. */
h->indexUsed -= ne;
for (j = 0; j < ne; j++, newEntry++) {
- headerRemoveEntry(h, newEntry->info.tag);
+ (void) headerRemoveEntry(h, newEntry->info.tag);
if (newEntry->info.tag == HEADER_BASENAMES)
- headerRemoveEntry(h, HEADER_OLDFILENAMES);
+ (void) headerRemoveEntry(h, HEADER_OLDFILENAMES);
}
/* If any duplicate entries were replaced, move new entries down. */
@@ -2214,7 +2214,8 @@ static int parseExpression(struct sprintfToken * token, char * str,
}
if (*chptr == '|') {
- parseFormat(xstrdup(""), tags, extensions, &token->u.cond.elseFormat,
+ (void) parseFormat(xstrdup(""), tags, extensions,
+ &token->u.cond.elseFormat,
&token->u.cond.numElseTokens, &end, PARSER_IN_EXPR,
errmsg);
} else {
@@ -2768,7 +2769,7 @@ void headerCopyTags(Header headerFrom, Header headerTo, int *tagstocopy)
if (!headerGetEntryMinMemory(headerFrom, *p, &type,
(const void **) &s, &count))
continue;
- headerAddEntry(headerTo, *p, type, s, count);
+ (void) headerAddEntry(headerTo, *p, type, s, count);
s = headerFreeData(s, type);
}
}
diff --git a/lib/md5sum.c b/lib/md5sum.c
index 5aead8f36..962c0eacd 100644
--- a/lib/md5sum.c
+++ b/lib/md5sum.c
@@ -46,7 +46,7 @@ static int domd5(const char * fn, unsigned char * digest, int asAscii,
rpmMD5Update(&ctx, buf, rc);
rpmMD5Final(bindigest, &ctx);
if (ferror(fp)) {
- fclose(fp);
+ (void) fclose(fp);
return 1;
}
@@ -73,7 +73,7 @@ static int domd5(const char * fn, unsigned char * digest, int asAscii,
(unsigned)bindigest[15]);
}
- fclose(fp);
+ (void) fclose(fp);
rc = 0;
#else
FD_t fd = Fopen(fn, "r.ufdio");
diff --git a/lib/misc.c b/lib/misc.c
index 0b0c4acf1..3ab73fb06 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -358,7 +358,7 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
errxit:
tempfn = _free(tempfn);
/*@-usereleased@*/
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
/*@=usereleased@*/
return 1;
}
@@ -389,6 +389,7 @@ static int dncmp(const void * a, const void * b)
void compressFilelist(Header h)
{
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char ** fileNames;
const char ** dirNames;
const char ** baseNames;
@@ -405,12 +406,11 @@ void compressFilelist(Header h)
*/
if (headerIsEntry(h, RPMTAG_DIRNAMES)) {
- headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
+ (void) headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
return; /* Already converted. */
}
- if (!headerGetEntry(h, RPMTAG_OLDFILENAMES, &fnt,
- (void **) &fileNames, &count))
+ if (!hge(h, RPMTAG_OLDFILENAMES, &fnt, (void **) &fileNames, &count))
return; /* no file list */
dirNames = alloca(sizeof(*dirNames) * count); /* worst case */
@@ -452,16 +452,16 @@ void compressFilelist(Header h)
}
exit:
- headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
+ (void) headerAddEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, count);
- headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, count);
- headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirIndex + 1);
fileNames = headerFreeData(fileNames, fnt);
- headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
+ (void) headerRemoveEntry(h, RPMTAG_OLDFILENAMES);
}
/*
@@ -472,6 +472,8 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
/*@out@*/ int * fileCountPtr, int baseNameTag,
int dirNameTag, int dirIndexesTag)
{
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+ HFD_t hfd = headerFreeData;
const char ** baseNames;
const char ** dirNames;
int * dirIndexes;
@@ -482,14 +484,14 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
char * data;
int i;
- if (!headerGetEntry(h, baseNameTag, &bnt, (void **) &baseNames, &count)) {
+ if (!hge(h, baseNameTag, &bnt, (void **) &baseNames, &count)) {
if (fileListPtr) *fileListPtr = NULL;
if (fileCountPtr) *fileCountPtr = 0;
return; /* no file list */
}
- headerGetEntry(h, dirNameTag, &dnt, (void **) &dirNames, NULL);
- headerGetEntry(h, dirIndexesTag, NULL, (void **) &dirIndexes, &count);
+ (void) hge(h, dirNameTag, &dnt, (void **) &dirNames, NULL);
+ (void) hge(h, dirIndexesTag, NULL, (void **) &dirIndexes, &count);
size = sizeof(*fileNames) * count;
for (i = 0; i < count; i++)
@@ -502,8 +504,8 @@ static void doBuildFileList(Header h, /*@out@*/ const char *** fileListPtr,
data = stpcpy( stpcpy(data, dirNames[dirIndexes[i]]), baseNames[i]);
*data++ = '\0';
}
- baseNames = headerFreeData(baseNames, bnt);
- dirNames = headerFreeData(dirNames, dnt);
+ baseNames = hfd(baseNames, bnt);
+ dirNames = hfd(dirNames, dnt);
if (fileListPtr)
*fileListPtr = fileNames;
@@ -522,14 +524,14 @@ void expandFilelist(Header h)
RPMTAG_DIRNAMES, RPMTAG_DIRINDEXES);
if (fileNames == NULL || count <= 0)
return;
- headerAddEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_OLDFILENAMES, RPM_STRING_ARRAY_TYPE,
fileNames, count);
fileNames = _free(fileNames);
}
- headerRemoveEntry(h, RPMTAG_DIRNAMES);
- headerRemoveEntry(h, RPMTAG_BASENAMES);
- headerRemoveEntry(h, RPMTAG_DIRINDEXES);
+ (void) headerRemoveEntry(h, RPMTAG_DIRNAMES);
+ (void) headerRemoveEntry(h, RPMTAG_BASENAMES);
+ (void) headerRemoveEntry(h, RPMTAG_DIRINDEXES);
}
@@ -779,6 +781,8 @@ int rpmPackageGetEntry( /*@unused@*/ void *leadp, Header sigs, Header h,
*/
void providePackageNVR(Header h)
{
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+ HFD_t hfd = headerFreeData;
const char *name, *version, *release;
int_32 * epoch;
const char *pEVR;
@@ -786,18 +790,19 @@ void providePackageNVR(Header h)
int_32 pFlags = RPMSENSE_EQUAL;
const char ** provides = NULL;
const char ** providesEVR = NULL;
+ int pnt, pvt;
int_32 * provideFlags = NULL;
int providesCount;
int i;
int bingo = 1;
/* Generate provides for this package name-version-release. */
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
if (!(name && version && release))
return;
pEVR = p = alloca(21 + strlen(version) + 1 + strlen(release) + 1);
*p = '\0';
- if (headerGetEntry(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) {
+ if (hge(h, RPMTAG_EPOCH, NULL, (void **) &epoch, NULL)) {
sprintf(p, "%d:", *epoch);
while (*p != '\0')
p++;
@@ -808,29 +813,25 @@ void providePackageNVR(Header h)
* Rpm prior to 3.0.3 does not have versioned provides.
* If no provides at all are available, we can just add.
*/
- if (!headerGetEntry(h, RPMTAG_PROVIDENAME, NULL,
- (void **) &provides, &providesCount)) {
+ if (!hge(h, RPMTAG_PROVIDENAME, &pnt, (void **) &provides, &providesCount))
goto exit;
- }
/*
* Otherwise, fill in entries on legacy packages.
*/
- if (!headerGetEntry(h, RPMTAG_PROVIDEVERSION, NULL,
- (void **) &providesEVR, NULL)) {
+ if (!hge(h, RPMTAG_PROVIDEVERSION, &pvt, (void **) &providesEVR, NULL)) {
for (i = 0; i < providesCount; i++) {
char * vdummy = "";
int_32 fdummy = RPMSENSE_ANY;
- headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
&vdummy, 1);
- headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
&fdummy, 1);
}
goto exit;
}
- headerGetEntry(h, RPMTAG_PROVIDEFLAGS, NULL,
- (void **) &provideFlags, NULL);
+ (void) hge(h, RPMTAG_PROVIDEFLAGS, NULL, (void **) &provideFlags, NULL);
for (i = 0; i < providesCount; i++) {
if (!(provideFlags[i] == RPMSENSE_EQUAL &&
@@ -841,15 +842,15 @@ void providePackageNVR(Header h)
}
exit:
- provides = headerFreeData(provides, -1);
- providesEVR = headerFreeData(providesEVR, -1);
+ provides = hfd(provides, pnt);
+ providesEVR = hfd(providesEVR, pvt);
if (bingo) {
- headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_PROVIDENAME, RPM_STRING_ARRAY_TYPE,
&name, 1);
- headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEFLAGS, RPM_INT32_TYPE,
&pFlags, 1);
- headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_PROVIDEVERSION, RPM_STRING_ARRAY_TYPE,
&pEVR, 1);
}
}
diff --git a/lib/package.c b/lib/package.c
index b3d256462..06d739bd6 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -43,7 +43,7 @@ void headerMergeLegacySigs(Header h, const Header sig)
/*@notreached@*/ break;
}
if (!headerIsEntry(h, tag))
- headerAddEntry(h, tag, type, ptr, count);
+ (void) headerAddEntry(h, tag, type, ptr, count);
}
headerFreeIterator(hi);
}
@@ -72,7 +72,7 @@ Header headerRegenSigHeader(const Header h)
/*@notreached@*/ break;
}
if (!headerIsEntry(sig, stag))
- headerAddEntry(sig, stag, type, ptr, count);
+ (void) headerAddEntry(sig, stag, type, ptr, count);
}
headerFreeIterator(hi);
return sig;
@@ -103,7 +103,8 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
hdr = hdrPtr ? hdrPtr : &hdrBlock;
lead = leadPtr ? leadPtr : &leadBlock;
- fstat(Fileno(fd), &sb);
+ memset(&sb, 0, sizeof(sb));
+ (void) fstat(Fileno(fd), &sb);
/* if fd points to a socket, pipe, etc, sb.st_size is *always* zero */
if (S_ISREG(sb.st_mode) && sb.st_size < sizeof(*lead)) return 1;
@@ -141,9 +142,9 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
* anyone.
*/
if (headerIsEntry(*hdr, RPMTAG_FILEUSERNAME))
- headerRemoveEntry(*hdr, RPMTAG_FILEUIDS);
+ (void) headerRemoveEntry(*hdr, RPMTAG_FILEUIDS);
if (headerIsEntry(*hdr, RPMTAG_FILEGROUPNAME))
- headerRemoveEntry(*hdr, RPMTAG_FILEGIDS);
+ (void) headerRemoveEntry(*hdr, RPMTAG_FILEGIDS);
/*
* We switched the way we do relocateable packages. We fix some of
@@ -155,7 +156,7 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
(void **) &defaultPrefix, NULL)) {
defaultPrefix =
stripTrailingChar(alloca_strdup(defaultPrefix), '/');
- headerAddEntry(*hdr, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(*hdr, RPMTAG_PREFIXES, RPM_STRING_ARRAY_TYPE,
&defaultPrefix, 1);
}
@@ -171,7 +172,7 @@ static rpmRC readPackageHeaders(FD_t fd, /*@out@*/ struct rpmlead * leadPtr,
/* XXX binary rpms always have RPMTAG_SOURCERPM, source rpms do not */
if (lead->type == RPMLEAD_SOURCE) {
if (!headerIsEntry(*hdr, RPMTAG_SOURCEPACKAGE))
- headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE,
+ (void)headerAddEntry(*hdr, RPMTAG_SOURCEPACKAGE, RPM_INT32_TYPE,
&true, 1);
} else if (lead->major < 4) {
/* Retrofit "Provide: name = EVR" for binary packages. */
diff --git a/lib/problems.c b/lib/problems.c
index 12e032964..1ff730906 100644
--- a/lib/problems.c
+++ b/lib/problems.c
@@ -115,38 +115,42 @@ const char * rpmProblemString(rpmProblem prob) /*@*/
switch (prob->type) {
case RPMPROB_BADARCH:
- snprintf(buf, nb, _("package %s is for a different architecture"),
+ (void) snprintf(buf, nb,
+ _("package %s is for a different architecture"),
prob->pkgNEVR);
break;
case RPMPROB_BADOS:
- snprintf(buf, nb, _("package %s is for a different operating system"),
+ (void) snprintf(buf, nb,
+ _("package %s is for a different operating system"),
prob->pkgNEVR);
break;
case RPMPROB_PKG_INSTALLED:
- snprintf(buf, nb, _("package %s is already installed"),
+ (void) snprintf(buf, nb,
+ _("package %s is already installed"),
prob->pkgNEVR);
break;
case RPMPROB_BADRELOCATE:
- snprintf(buf, nb, _("path %s in package %s is not relocateable"),
+ (void) snprintf(buf, nb,
+ _("path %s in package %s is not relocateable"),
prob->str1, prob->pkgNEVR);
break;
case RPMPROB_NEW_FILE_CONFLICT:
- snprintf(buf, nb,
+ (void) snprintf(buf, nb,
_("file %s conflicts between attempted installs of %s and %s"),
prob->str1, prob->pkgNEVR, prob->altNEVR);
break;
case RPMPROB_FILE_CONFLICT:
- snprintf(buf, nb,
+ (void) snprintf(buf, nb,
_("file %s from install of %s conflicts with file from package %s"),
prob->str1, prob->pkgNEVR, prob->altNEVR);
break;
case RPMPROB_OLDPACKAGE:
- snprintf(buf, nb,
+ (void) snprintf(buf, nb,
_("package %s (which is newer than %s) is already installed"),
prob->altNEVR, prob->pkgNEVR);
break;
case RPMPROB_DISKSPACE:
- snprintf(buf, nb,
+ (void) snprintf(buf, nb,
_("installing package %s needs %ld%cb on the %s filesystem"),
prob->pkgNEVR,
prob->ulong1 > (1024*1024)
@@ -156,19 +160,19 @@ const char * rpmProblemString(rpmProblem prob) /*@*/
prob->str1);
break;
case RPMPROB_DISKNODES:
- snprintf(buf, nb,
+ (void) snprintf(buf, nb,
_("installing package %s needs %ld inodes on the %s filesystem"),
prob->pkgNEVR, (long)prob->ulong1, prob->str1);
break;
case RPMPROB_BADPRETRANS:
- snprintf(buf, nb,
+ (void) snprintf(buf, nb,
_("package %s pre-transaction syscall(s): %s failed: %s"),
prob->pkgNEVR, prob->str1, strerror(prob->ulong1));
break;
case RPMPROB_REQUIRES:
case RPMPROB_CONFLICT:
default:
- snprintf(buf, nb,
+ (void) snprintf(buf, nb,
_("unknown error %d encountered while manipulating package %s"),
prob->type, prob->pkgNEVR);
break;
diff --git a/lib/psm.c b/lib/psm.c
index f04ec3eb7..6a58173da 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -48,15 +48,15 @@ int rpmVersionCompare(Header first, Header second)
return 1;
}
- headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
- headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
+ (void) headerGetEntry(first, RPMTAG_VERSION, NULL, (void **) &one, NULL);
+ (void) headerGetEntry(second, RPMTAG_VERSION, NULL, (void **) &two, NULL);
rc = rpmvercmp(one, two);
if (rc)
return rc;
- headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
- headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
+ (void) headerGetEntry(first, RPMTAG_RELEASE, NULL, (void **) &one, NULL);
+ (void) headerGetEntry(second, RPMTAG_RELEASE, NULL, (void **) &two, NULL);
return rpmvercmp(one, two);
}
@@ -83,11 +83,11 @@ void loadFi(Header h, TFI_t fi)
if (h && fi->h == NULL) fi->h = headerLink(h);
/* Duplicate name-version-release so that headers can be free'd. */
- hge(fi->h, RPMTAG_NAME, NULL, (void **) &fi->name, NULL);
+ rc = hge(fi->h, RPMTAG_NAME, NULL, (void **) &fi->name, NULL);
fi->name = xstrdup(fi->name);
- hge(fi->h, RPMTAG_VERSION, NULL, (void **) &fi->version, NULL);
+ rc = hge(fi->h, RPMTAG_VERSION, NULL, (void **) &fi->version, NULL);
fi->version = xstrdup(fi->version);
- hge(fi->h, RPMTAG_RELEASE, NULL, (void **) &fi->release, NULL);
+ rc = hge(fi->h, RPMTAG_RELEASE, NULL, (void **) &fi->release, NULL);
fi->release = xstrdup(fi->release);
/* -1 means not found */
@@ -103,12 +103,12 @@ void loadFi(Header h, TFI_t fi)
return;
}
- hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
- hge(fi->h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
- hge(fi->h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL);
- hge(fi->h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL);
- hge(fi->h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL);
- hge(fi->h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL);
+ rc = hge(fi->h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
+ rc = hge(fi->h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
+ rc = hge(fi->h, RPMTAG_FILEMODES, NULL, (void **) &fi->fmodes, NULL);
+ rc = hge(fi->h, RPMTAG_FILEFLAGS, NULL, (void **) &fi->fflags, NULL);
+ rc = hge(fi->h, RPMTAG_FILESIZES, NULL, (void **) &fi->fsizes, NULL);
+ rc = hge(fi->h, RPMTAG_FILESTATES, NULL, (void **) &fi->fstates, NULL);
fi->action = FA_UNKNOWN;
fi->flags = 0;
@@ -120,10 +120,10 @@ void loadFi(Header h, TFI_t fi)
switch (fi->type) {
case TR_ADDED:
fi->mapflags = CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
- hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
- hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
- hge(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
- hge(fi->h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL);
+ rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
+ rc = hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
+ rc = hge(fi->h, RPMTAG_FILELANGS, NULL, (void **) &fi->flangs, NULL);
+ rc = hge(fi->h, RPMTAG_FILEMTIMES, NULL, (void **) &fi->fmtimes, NULL);
/* 0 makes for noops */
fi->replacedSizes = xcalloc(fi->fc, sizeof(*fi->replacedSizes));
@@ -131,8 +131,8 @@ void loadFi(Header h, TFI_t fi)
break;
case TR_REMOVED:
fi->mapflags = CPIO_MAP_ABSOLUTE | CPIO_MAP_ADDDOT | CPIO_MAP_PATH | CPIO_MAP_MODE;
- hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
- hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
+ rc = hge(fi->h, RPMTAG_FILEMD5S, NULL, (void **) &fi->fmd5s, NULL);
+ rc = hge(fi->h, RPMTAG_FILELINKTOS, NULL, (void **) &fi->flinks, NULL);
fi->fsizes = memcpy(xmalloc(fi->fc * sizeof(*fi->fsizes)),
fi->fsizes, fi->fc * sizeof(*fi->fsizes));
fi->fflags = memcpy(xmalloc(fi->fc * sizeof(*fi->fflags)),
@@ -317,15 +317,15 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
RPMTAG_CONFLICTNAME, RPMTAG_CONFLICTVERSION, RPMTAG_CONFLICTFLAGS
};
- hge(h, RPMTAG_SIZE, NULL, (void **) &fileSizes, NULL);
+ (void) hge(h, RPMTAG_SIZE, NULL, (void **) &fileSizes, NULL);
fileSize = *fileSizes;
- hge(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count);
+ (void) hge(newH, RPMTAG_FILESIZES, NULL, (void **) &fileSizes, &count);
for (i = 0, fc = 0; i < count; i++)
if (actions[i] != FA_SKIPMULTILIB) {
fc++;
fileSize += fileSizes[i];
}
- headerModifyEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
+ (void) headerModifyEntry(h, RPMTAG_SIZE, RPM_INT32_TYPE, &fileSize, 1);
for (i = 0; mergeTags[i]; i++) {
if (!hge(newH, mergeTags[i], &type, (void **) &data, &count))
@@ -337,7 +337,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_8 *) newdata)[k++] = ((int_8 *) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
+ (void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_INT16_TYPE:
@@ -345,7 +345,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_16 *) newdata)[k++] = ((int_16 *) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
+ (void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_INT32_TYPE:
@@ -353,7 +353,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((int_32 *) newdata)[k++] = ((int_32 *) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
+ (void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
case RPM_STRING_ARRAY_TYPE:
@@ -361,7 +361,7 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
for (j = 0, k = 0; j < count; j++)
if (actions[j] != FA_SKIPMULTILIB)
((char **) newdata)[k++] = ((char **) data)[j];
- headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
+ (void) headerAddOrAppendEntry(h, mergeTags[i], type, newdata, fc);
free (newdata);
break;
default:
@@ -372,10 +372,10 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
}
data = hfd(data, type);
}
- hge(newH, RPMTAG_DIRINDEXES, NULL, (void **) &newDirIndexes, &count);
- hge(newH, RPMTAG_DIRNAMES, NULL, (void **) &newDirNames, NULL);
- hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
- hge(h, RPMTAG_DIRNAMES, NULL, (void **) &data, &dirNamesCount);
+ (void) hge(newH, RPMTAG_DIRINDEXES, NULL, (void **) &newDirIndexes, &count);
+ (void) hge(newH, RPMTAG_DIRNAMES, NULL, (void **) &newDirNames, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &data, &dirNamesCount);
dirNames = xcalloc(dirNamesCount + fc, sizeof(char *));
for (i = 0; i < dirNamesCount; i++)
@@ -392,9 +392,9 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
dirNames[dirCount++] = newDirNames[newDirIndexes[i]];
((int_32 *) newdata)[k++] = j;
}
- headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata, fc);
+ (void) headerAddOrAppendEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE, newdata, fc);
if (dirCount > dirNamesCount)
- headerAddOrAppendEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddOrAppendEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames + dirNamesCount,
dirCount - dirNamesCount);
data = hfd(data, -1);
@@ -411,12 +411,12 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
if (!hge(newH, requireTags[i], &nnt, (void **) &newNames, &newCount))
continue;
- hge(newH, requireTags[i+1], &nvt, (void **) &newEVR, NULL);
- hge(newH, requireTags[i+2], NULL, (void **) &newFlags, NULL);
+ (void) hge(newH, requireTags[i+1], &nvt, (void **) &newEVR, NULL);
+ (void) hge(newH, requireTags[i+2], NULL, (void **) &newFlags, NULL);
if (hge(h, requireTags[i], &rnt, (void **) &Names, &Count))
{
- hge(h, requireTags[i+1], NULL, (void **) &EVR, NULL);
- hge(h, requireTags[i+2], NULL, (void **) &Flags, NULL);
+ (void) hge(h, requireTags[i+1], NULL, (void **) &EVR, NULL);
+ (void) hge(h, requireTags[i+2], NULL, (void **) &Flags, NULL);
for (j = 0; j < newCount; j++)
for (k = 0; k < Count; k++)
if (!strcmp (newNames[j], Names[k])
@@ -439,11 +439,11 @@ static int mergeFiles(TFI_t fi, Header h, Header newH)
k++;
}
if (k) {
- headerAddOrAppendEntry(h, requireTags[i],
+ (void) headerAddOrAppendEntry(h, requireTags[i],
RPM_STRING_ARRAY_TYPE, newNames, k);
- headerAddOrAppendEntry(h, requireTags[i+1],
+ (void) headerAddOrAppendEntry(h, requireTags[i+1],
RPM_STRING_ARRAY_TYPE, newEVR, k);
- headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE,
+ (void) headerAddOrAppendEntry(h, requireTags[i+2], RPM_INT32_TYPE,
newFlags, k);
}
newNames = hfd(newNames, nnt);
@@ -494,7 +494,7 @@ static int markReplacedFiles(PSM_t psm)
}
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
- rpmdbAppendIterator(mi, offsets, num);
+ (void) rpmdbAppendIterator(mi, offsets, num);
sfi = replaced;
while ((h = rpmdbNextIterator(mi)) != NULL) {
@@ -516,7 +516,7 @@ static int markReplacedFiles(PSM_t psm)
if (modified == 0) {
/* Modified header will be rewritten. */
modified = 1;
- rpmdbSetIteratorModified(mi, modified);
+ (void) rpmdbSetIteratorModified(mi, modified);
}
num++;
}
@@ -610,7 +610,7 @@ rpmRC rpmInstallSourcePackage(const char * rootDir, FD_t fd,
headerFree(h); /* XXX reference held by transaction set */
h = NULL;
- rpmInstallLoadMacros(fi, fi->h);
+ (void) rpmInstallLoadMacros(fi, fi->h);
memset(psm, 0, sizeof(*psm));
psm->ts = ts;
@@ -812,7 +812,7 @@ static int runScript(PSM_t psm, Header h,
argc = progArgc;
}
- headerNVR(h, &n, &v, &r);
+ (void) headerNVR(h, &n, &v, &r);
if (hge(h, RPMTAG_INSTPREFIXES, &ipt, (void **) &prefixes, &numPrefixes)) {
freePrefixes = 1;
} else if (hge(h, RPMTAG_INSTALLPREFIX, NULL, (void **) &oldPrefix, NULL)) {
@@ -838,10 +838,10 @@ static int runScript(PSM_t psm, Header h,
if (rpmIsDebug() &&
(!strcmp(argv[0], "/bin/sh") || !strcmp(argv[0], "/bin/bash")))
- (void)Fwrite("set -x\n", sizeof(char), 7, fd);
+ (void) Fwrite("set -x\n", sizeof(char), 7, fd);
- (void)Fwrite(script, sizeof(script[0]), strlen(script), fd);
- Fclose(fd);
+ (void) Fwrite(script, sizeof(script[0]), strlen(script), fd);
+ (void) Fclose(fd);
{ const char * sn = fn;
if (!ts->chrootDone &&
@@ -886,22 +886,22 @@ static int runScript(PSM_t psm, Header h,
pipes[0] = pipes[1] = 0;
/* make stdin inaccessible */
- pipe(pipes);
- close(pipes[1]);
- dup2(pipes[0], STDIN_FILENO);
- close(pipes[0]);
+ (void) pipe(pipes);
+ (void) close(pipes[1]);
+ (void) dup2(pipes[0], STDIN_FILENO);
+ (void) close(pipes[0]);
if (ts->scriptFd != NULL) {
if (Fileno(ts->scriptFd) != STDERR_FILENO)
- dup2(Fileno(ts->scriptFd), STDERR_FILENO);
+ (void) dup2(Fileno(ts->scriptFd), STDERR_FILENO);
if (Fileno(out) != STDOUT_FILENO)
- dup2(Fileno(out), STDOUT_FILENO);
+ (void) dup2(Fileno(out), STDOUT_FILENO);
/* make sure we don't close stdin/stderr/stdout by mistake! */
if (Fileno(out) > STDERR_FILENO && Fileno(out) != Fileno(ts->scriptFd)) {
- Fclose (out);
+ (void) Fclose (out);
}
if (Fileno(ts->scriptFd) > STDERR_FILENO) {
- Fclose (ts->scriptFd);
+ (void) Fclose (ts->scriptFd);
}
}
@@ -910,18 +910,18 @@ static int runScript(PSM_t psm, Header h,
if (ipath && ipath[5] != '%')
path = ipath;
- doputenv(path);
+ (void) doputenv(path);
ipath = _free(ipath);
}
for (i = 0; i < numPrefixes; i++) {
sprintf(prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]);
- doputenv(prefixBuf);
+ (void) doputenv(prefixBuf);
/* backwards compatibility */
if (i == 0) {
sprintf(prefixBuf, "RPM_INSTALL_PREFIX=%s", prefixes[i]);
- doputenv(prefixBuf);
+ (void) doputenv(prefixBuf);
}
}
@@ -935,8 +935,8 @@ static int runScript(PSM_t psm, Header h,
if (!ts->chrootDone && !(rootDir[0] == '/' && rootDir[1] == '\0')) {
/*@-unrecog@*/ chroot(rootDir); /*@=unrecog@*/
}
- chdir("/");
- execv(argv[0], (char *const *)argv);
+ (void) chdir("/");
+ (void) execv(argv[0], (char *const *)argv);
break;
default:
break;
@@ -963,10 +963,11 @@ static int runScript(PSM_t psm, Header h,
if (freePrefixes) prefixes = hfd(prefixes, ipt);
- Fclose(out); /* XXX dup'd STDOUT_FILENO */
+ (void) Fclose(out); /* XXX dup'd STDOUT_FILENO */
if (script) {
- if (!rpmIsDebug()) unlink(fn);
+ if (!rpmIsDebug())
+ (void) unlink(fn);
fn = _free(fn);
}
@@ -994,8 +995,8 @@ static rpmRC runInstScript(PSM_t psm)
* headerGetEntry() sets the data pointer to NULL if the entry does
* not exist.
*/
- hge(fi->h, psm->progTag, &ptt, (void **) &programArgv, &programArgc);
- hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL);
+ (void) hge(fi->h, psm->progTag, &ptt, (void **) &programArgv, &programArgc);
+ (void) hge(fi->h, psm->scriptTag, &stt, (void **) &script, NULL);
if (programArgv && ptt == RPM_STRING_TYPE) {
argv = alloca(sizeof(char *));
@@ -1045,10 +1046,10 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
(void **) &triggerNames, &numTriggers))
return 0;
- headerNVR(sourceH, &sourceName, NULL, NULL);
+ (void) headerNVR(sourceH, &sourceName, NULL, NULL);
- hge(triggeredH, RPMTAG_TRIGGERFLAGS, &tft, (void **) &triggerFlags, NULL);
- hge(triggeredH, RPMTAG_TRIGGERVERSION, &tvt, (void **) &triggerEVR, NULL);
+ (void) hge(triggeredH, RPMTAG_TRIGGERFLAGS, &tft, (void **) &triggerFlags, NULL);
+ (void) hge(triggeredH, RPMTAG_TRIGGERVERSION, &tvt, (void **) &triggerEVR, NULL);
for (i = 0; i < numTriggers; i++) {
int_32 tit, tst, tpt;
@@ -1073,14 +1074,14 @@ static int handleOneTrigger(PSM_t psm, Header sourceH, Header triggeredH,
triggerEVR[i] + skip, triggerFlags[i]))
continue;
- hge(triggeredH, RPMTAG_TRIGGERINDEX, &tit,
+ (void) hge(triggeredH, RPMTAG_TRIGGERINDEX, &tit,
(void **) &triggerIndices, NULL);
- hge(triggeredH, RPMTAG_TRIGGERSCRIPTS, &tst,
+ (void) hge(triggeredH, RPMTAG_TRIGGERSCRIPTS, &tst,
(void **) &triggerScripts, NULL);
- hge(triggeredH, RPMTAG_TRIGGERSCRIPTPROG, &tpt,
+ (void) hge(triggeredH, RPMTAG_TRIGGERSCRIPTPROG, &tpt,
(void **) &triggerProgs, NULL);
- headerNVR(triggeredH, &triggerPackageName, NULL, NULL);
+ (void) headerNVR(triggeredH, &triggerPackageName, NULL, NULL);
{ int arg1;
int index;
@@ -1178,7 +1179,7 @@ static int runImmedTriggers(PSM_t psm)
(void **) &triggerNames, &numTriggers))
return 0;
- hge(fi->h, RPMTAG_TRIGGERINDEX, &tit, (void **) &triggerIndices,
+ (void) hge(fi->h, RPMTAG_TRIGGERINDEX, &tit, (void **) &triggerIndices,
&numTriggerIndices);
triggersRun = alloca(sizeof(*triggersRun) * numTriggerIndices);
memset(triggersRun, 0, sizeof(*triggersRun) * numTriggerIndices);
@@ -1321,10 +1322,10 @@ assert(psm->mi == NULL);
rpmBuildFileList(fi->h, &fi->apath, NULL);
if (fi->fuser == NULL)
- hge(fi->h, RPMTAG_FILEUSERNAME, NULL,
+ (void) hge(fi->h, RPMTAG_FILEUSERNAME, NULL,
(void **) &fi->fuser, NULL);
if (fi->fgroup == NULL)
- hge(fi->h, RPMTAG_FILEGROUPNAME, NULL,
+ (void) hge(fi->h, RPMTAG_FILEGROUPNAME, NULL,
(void **) &fi->fgroup, NULL);
if (fi->fuids == NULL)
fi->fuids = xcalloc(sizeof(*fi->fuids), fi->fc);
@@ -1511,7 +1512,7 @@ assert(psm->mi == NULL);
(void) fsmTeardown(fi->fsm);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
- Fclose(psm->cfd);
+ (void) Fclose(psm->cfd);
psm->cfd = NULL;
errno = saveerrno; /* XXX FIXME: Fclose with libio destroys errno */
@@ -1560,7 +1561,7 @@ assert(psm->mi == NULL);
fi->action = FA_COPYOUT;
fi->actions = NULL;
- Fflush(psm->fd);
+ (void) Fflush(psm->fd);
psm->cfd = Fdopen(fdDup(Fileno(psm->fd)), psm->rpmio_flags);
/* XXX failedFile? */
@@ -1568,7 +1569,7 @@ assert(psm->mi == NULL);
(void) fsmTeardown(fi->fsm);
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
- Fclose(psm->cfd);
+ (void) Fclose(psm->cfd);
psm->cfd = NULL;
errno = saveerrno;
@@ -1583,20 +1584,21 @@ assert(psm->mi == NULL);
int_32 installTime = time(NULL);
if (fi->fc > 0 && fi->fstates)
- headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE,
+ (void) headerAddEntry(fi->h, RPMTAG_FILESTATES, RPM_CHAR_TYPE,
fi->fstates, fi->fc);
- headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
+ (void) headerAddEntry(fi->h, RPMTAG_INSTALLTIME, RPM_INT32_TYPE,
&installTime, 1);
if (ts->transFlags & RPMTRANS_FLAG_MULTILIB) {
uint_32 multiLib, * newMultiLib, * p;
if (hge(fi->h, RPMTAG_MULTILIBS, NULL, (void **) &newMultiLib, NULL) &&
- hge(psm->oh, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL)) {
+ hge(psm->oh, RPMTAG_MULTILIBS, NULL, (void **) &p, NULL))
+ {
multiLib = *p;
multiLib |= *newMultiLib;
- headerModifyEntry(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
+ (void) headerModifyEntry(psm->oh, RPMTAG_MULTILIBS, RPM_INT32_TYPE,
&multiLib, 1);
}
rc = mergeFiles(fi, psm->oh, fi->h);
@@ -1674,7 +1676,7 @@ assert(psm->mi == NULL);
if (psm->fd) {
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
- Fclose(psm->fd);
+ (void) Fclose(psm->fd);
psm->fd = NULL;
errno = saveerrno;
}
@@ -1754,7 +1756,7 @@ assert(psm->mi == NULL);
_loaded++;
}
- chdir("/");
+ (void) chdir("/");
/*@-unrecog@*/
rc = chroot(ts->rootDir);
/*@=unrecog@*/
@@ -1768,7 +1770,7 @@ assert(psm->mi == NULL);
rc = chroot(".");
/*@=unrecog@*/
psm->chrootDone = ts->chrootDone = 0;
- chdir(ts->currDir);
+ (void) chdir(ts->currDir);
}
break;
case PSM_SCRIPT:
diff --git a/lib/query.c b/lib/query.c
index 6edae3a8e..3adc0e126 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -136,6 +136,8 @@ static int countLinks(int_16 * fileRdevList, int_32 * fileInodeList, int nfiles,
int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
{
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+ HFD_t hfd = headerFreeData;
char * t, * te;
int queryFlags = qva->qva_flags;
@@ -145,6 +147,7 @@ int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
char * prefix = NULL;
const char ** dirNames = NULL;
const char ** baseNames = NULL;
+ int bnt, dnt;
const char ** fileMD5List = NULL;
const char ** fileOwnerList = NULL;
const char ** fileGroupList = NULL;
@@ -166,7 +169,7 @@ int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
if (!queryFormat && !queryFlags) {
const char * name, * version, * release;
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
te = stpcpy(te, name);
te = stpcpy( stpcpy(te, "-"), version);
te = stpcpy( stpcpy(te, "-"), release);
@@ -194,39 +197,35 @@ int showQueryPackage(QVA_t *qva, /*@unused@*/rpmdb rpmdb, Header h)
if (!(queryFlags & QUERY_FOR_LIST))
goto exit;
- if (!headerGetEntry(h, RPMTAG_BASENAMES, &type,
- (void **) &baseNames, &count)) {
+ if (!hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count)) {
te = stpcpy(te, _("(contains no files)"));
goto exit;
}
- if (!headerGetEntry(h, RPMTAG_FILESTATES, &type,
- (void **) &fileStatesList, &count)) {
+ if (!hge(h, RPMTAG_FILESTATES, &type, (void **) &fileStatesList, &count)) {
fileStatesList = NULL;
}
- headerGetEntry(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, NULL);
- headerGetEntry(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
- headerGetEntry(h, RPMTAG_FILEFLAGS, &type, (void **)&fileFlagsList, &count);
- headerGetEntry(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, &count);
- headerGetEntry(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, &count);
- headerGetEntry(h, RPMTAG_FILEMTIMES, &type, (void **)&fileMTimeList,&count);
- headerGetEntry(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, &count);
- headerGetEntry(h, RPMTAG_FILEINODES, &type, (void **)&fileInodeList,&count);
- headerGetEntry(h, RPMTAG_FILELINKTOS,&type,(void **)&fileLinktoList,&count);
- headerGetEntry(h, RPMTAG_FILEMD5S, &type, (void **) &fileMD5List, &count);
-
- if (!headerGetEntry(h, RPMTAG_FILEUIDS, &type,
- (void **) &fileUIDList, &count)) {
+ (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_FILEFLAGS, &type, (void **)&fileFlagsList, &count);
+ (void) hge(h, RPMTAG_FILESIZES, &type, (void **) &fileSizeList, &count);
+ (void) hge(h, RPMTAG_FILEMODES, &type, (void **) &fileModeList, &count);
+ (void) hge(h, RPMTAG_FILEMTIMES, &type, (void **)&fileMTimeList,&count);
+ (void) hge(h, RPMTAG_FILERDEVS, &type, (void **) &fileRdevList, &count);
+ (void) hge(h, RPMTAG_FILEINODES, &type, (void **)&fileInodeList,&count);
+ (void) hge(h, RPMTAG_FILELINKTOS,&type,(void **)&fileLinktoList,&count);
+ (void) hge(h, RPMTAG_FILEMD5S, &type, (void **) &fileMD5List, &count);
+
+ if (!hge(h, RPMTAG_FILEUIDS, &type, (void **) &fileUIDList, &count)) {
fileUIDList = NULL;
- } else if (!headerGetEntry(h, RPMTAG_FILEGIDS, &type,
+ } else if (!hge(h, RPMTAG_FILEGIDS, &type,
(void **) &fileGIDList, &count)) {
fileGIDList = NULL;
}
- if (!headerGetEntry(h, RPMTAG_FILEUSERNAME, &type,
- (void **) &fileOwnerList, &count)) {
+ if (!hge(h, RPMTAG_FILEUSERNAME, &type, (void **) &fileOwnerList, &count)) {
fileOwnerList = NULL;
- } else if (!headerGetEntry(h, RPMTAG_FILEGROUPNAME, &type,
- (void **) &fileGroupList, &count)) {
+ } else
+ if (!hge(h, RPMTAG_FILEGROUPNAME, &type, (void **) &fileGroupList, &count)) {
fileGroupList = NULL;
}
@@ -349,12 +348,12 @@ exit:
rpmMessage(RPMMESS_NORMAL, "%s", t);
}
t = _free(t);
- dirNames = headerFreeData(dirNames, -1);
- baseNames = headerFreeData(baseNames, -1);
- fileLinktoList = headerFreeData(fileLinktoList, -1);
- fileMD5List = headerFreeData(fileMD5List, -1);
- fileOwnerList = headerFreeData(fileOwnerList, -1);
- fileGroupList = headerFreeData(fileGroupList, -1);
+ dirNames = hfd(dirNames, dnt);
+ baseNames = hfd(baseNames, bnt);
+ fileLinktoList = hfd(fileLinktoList, -1);
+ fileMD5List = hfd(fileMD5List, -1);
+ fileOwnerList = hfd(fileOwnerList, -1);
+ fileGroupList = hfd(fileGroupList, -1);
return rc;
}
@@ -511,13 +510,13 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fileURL,
Fstrerror(fd));
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
retcode = 1;
break;
}
rpmrc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
- Fclose(fd);
+ (void) Fclose(fd);
if (!(rpmrc == RPMRC_OK || rpmrc == RPMRC_BADMAGIC)) {
rpmError(RPMERR_QUERY, _("query of %s failed\n"), fileURL);
@@ -543,7 +542,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fileURL,
Fstrerror(fd));
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
retcode = 1;
break;
}
@@ -555,7 +554,7 @@ restart:
fileURL, Fstrerror(fd));
retcode = 1;
}
- Fclose(fd);
+ (void) Fclose(fd);
/* If successful, restart the query loop. */
if (retcode == 0)
@@ -608,7 +607,7 @@ restart:
}
for (pkg = spec->packages; pkg != NULL; pkg = pkg->next) {
- showPackage(qva, NULL, pkg->header);
+ (void) showPackage(qva, NULL, pkg->header);
}
freeSpecVec(spec);
} break;
@@ -768,7 +767,7 @@ int rpmQuery(QVA_t *qva, rpmQVSources source, const char * arg)
rc = rpmQueryVerify(qva, source, arg, rpmdb, showQueryPackage);
if (rpmdb != NULL)
- rpmdbClose(rpmdb);
+ (void) rpmdbClose(rpmdb);
return rc;
}
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index d4f8025b6..82f9e0b6e 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -27,7 +27,7 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
/* close and reset *fdp to NULL */
if (*fdp && (fnp == NULL || *fnp == NULL)) {
- Fclose(*fdp);
+ (void) Fclose(*fdp);
*fdp = NULL;
return 0;
}
@@ -94,8 +94,8 @@ static int copyFile(FD_t *sfdp, const char **sfnp,
rc = 0;
exit:
- if (*sfdp) manageFile(sfdp, NULL, 0, rc);
- if (*tfdp) manageFile(tfdp, NULL, 0, rc);
+ if (*sfdp) (void) manageFile(sfdp, NULL, 0, rc);
+ if (*tfdp) (void) manageFile(tfdp, NULL, 0, rc);
return rc;
}
@@ -159,12 +159,12 @@ int rpmReSign(rpmResignFlags add, char *passPhrase, const char **argv)
if (add != RESIGN_ADD_SIGNATURE) {
rpmFreeSignature(sig);
sig = rpmNewSignature();
- rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
- rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
+ (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_SIZE, passPhrase);
+ (void) rpmAddSignature(sig, sigtarget, RPMSIGTAG_MD5, passPhrase);
}
if ((sigtype = rpmLookupSignatureType(RPMLOOKUPSIG_QUERY)) > 0)
- rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
+ (void) rpmAddSignature(sig, sigtarget, sigtype, passPhrase);
/* Write the lead/signature of the output rpm */
strcpy(tmprpm, rpm);
@@ -196,30 +196,31 @@ int rpmReSign(rpmResignFlags add, char *passPhrase, const char **argv)
/* ASSERT: fd == NULL && ofd == NULL */
/* Clean up intermediate target */
- unlink(sigtarget);
+ (void) unlink(sigtarget);
sigtarget = _free(sigtarget);
/* Move final target into place. */
- unlink(rpm);
- rename(trpm, rpm); tmprpm[0] = '\0';
+ (void) unlink(rpm);
+ (void) rename(trpm, rpm);
+ tmprpm[0] = '\0';
}
res = 0;
exit:
- if (fd) manageFile(&fd, NULL, 0, res);
- if (ofd) manageFile(&ofd, NULL, 0, res);
+ if (fd) (void) manageFile(&fd, NULL, 0, res);
+ if (ofd) (void) manageFile(&ofd, NULL, 0, res);
if (sig) {
rpmFreeSignature(sig);
sig = NULL;
}
if (sigtarget) {
- unlink(sigtarget);
+ (void) unlink(sigtarget);
sigtarget = _free(sigtarget);
}
if (tmprpm[0] != '\0') {
- unlink(tmprpm);
+ (void) unlink(tmprpm);
tmprpm[0] = '\0';
}
@@ -422,7 +423,7 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char **argv)
}
headerFreeIterator(hi);
res += res2;
- unlink(sigtarget);
+ (void) unlink(sigtarget);
sigtarget = _free(sigtarget);
if (res2) {
@@ -455,10 +456,10 @@ int rpmCheckSig(rpmCheckSigFlags flags, const char **argv)
}
bottom:
- if (fd) manageFile(&fd, NULL, 0, 0);
- if (ofd) manageFile(&ofd, NULL, 0, 0);
+ if (fd) (void) manageFile(&fd, NULL, 0, 0);
+ if (ofd) (void) manageFile(&ofd, NULL, 0, 0);
if (sigtarget) {
- unlink(sigtarget);
+ (void) unlink(sigtarget);
sigtarget = _free(sigtarget);
}
}
diff --git a/lib/rpmdb.c b/lib/rpmdb.c
index 7acc3a6c0..c5fb6edc5 100644
--- a/lib/rpmdb.c
+++ b/lib/rpmdb.c
@@ -630,8 +630,8 @@ static void blockSignals(rpmdb rpmdb, /*@out@*/ sigset_t * oldMask)
/* XXX HACK (disabled) permit ^C aborts for now ... */
if (!(rpmdb && rpmdb->db_api == 4)) {
- sigfillset(&newMask); /* block all signals */
- sigprocmask(SIG_BLOCK, &newMask, oldMask);
+ (void) sigfillset(&newMask); /* block all signals */
+ (void) sigprocmask(SIG_BLOCK, &newMask, oldMask);
}
}
@@ -642,7 +642,7 @@ static void unblockSignals(rpmdb rpmdb, sigset_t * oldMask)
{
/* XXX HACK (disabled) permit ^C aborts for now ... */
if (!(rpmdb && rpmdb->db_api == 4)) {
- sigprocmask(SIG_SETMASK, oldMask, NULL);
+ (void) sigprocmask(SIG_SETMASK, oldMask, NULL);
}
}
@@ -685,7 +685,7 @@ int rpmdbClose (rpmdb rpmdb)
if (rpmdb->_dbi[dbix] == NULL)
continue;
/*@-unqualifiedtrans@*/
- dbiClose(rpmdb->_dbi[dbix], 0);
+ (void) dbiClose(rpmdb->_dbi[dbix], 0);
rpmdb->_dbi[dbix] = NULL;
/*@=unqualifiedtrans@*/
}
@@ -735,7 +735,7 @@ static /*@only@*/ rpmdb newRpmdb(/*@kept@*/ const char * root,
rpmdb->db_home = rpmGetPath( (home && *home ? home : _DB_HOME), NULL);
if (!(rpmdb->db_home && rpmdb->db_home[0] != '%')) {
rpmError(RPMERR_DBOPEN, _("no dbpath has been set\n"));
- rpmdbClose(rpmdb);
+ (void) rpmdbClose(rpmdb);
/*@-globstate@*/ return NULL; /*@=globstate@*/
}
rpmdb->db_errpfx = rpmExpand( (epfx && *epfx ? epfx : _DB_ERRPFX), NULL);
@@ -844,7 +844,7 @@ static int openDatabase(const char * prefix, const char * dbpath, int _dbapi,
exit:
if (rc || justCheck || dbp == NULL)
- rpmdbClose(rpmdb);
+ (void) rpmdbClose(rpmdb);
else
*dbp = rpmdb;
@@ -867,8 +867,8 @@ int rpmdbInit (const char * prefix, int perms)
rc = openDatabase(prefix, NULL, _dbapi, &rpmdb, (O_CREAT | O_RDWR),
perms, RPMDB_FLAG_JUSTCHECK);
if (rpmdb) {
- rpmdbOpenAll(rpmdb);
- rpmdbClose(rpmdb);
+ (void) rpmdbOpenAll(rpmdb);
+ (void) rpmdbClose(rpmdb);
rpmdb = NULL;
}
return rc;
@@ -946,9 +946,9 @@ static int rpmdbFindByFile(rpmdb rpmdb, const char * filespec,
continue;
}
- hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
- hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
- hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
do {
fingerPrint fp2;
@@ -958,7 +958,7 @@ static int rpmdbFindByFile(rpmdb rpmdb, const char * filespec,
if (FP_EQUAL(fp1, fp2)) {
rec->hdrNum = dbiIndexRecordOffset(allMatches, i);
rec->tagNum = dbiIndexRecordFileNumber(allMatches, i);
- dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
+ (void) dbiAppendSet(*matches, rec, 1, sizeof(*rec), 0);
}
prevoff = offset;
@@ -1071,7 +1071,7 @@ static int dbiFindMatches(dbiIndex dbi, DBC * dbcursor,
goto exit;
}
- headerNVR(h, NULL, &pkgVersion, &pkgRelease);
+ (void) headerNVR(h, NULL, &pkgVersion, &pkgRelease);
goodRelease = goodVersion = 1;
@@ -1200,8 +1200,8 @@ struct _rpmdbMatchIterator {
unsigned int mi_filenum;
unsigned int mi_fpnum;
unsigned int mi_dbnum;
-/*@only@*/ const char *mi_version;
-/*@only@*/ const char *mi_release;
+/*@only@*/ const char * mi_version;
+/*@only@*/ const char * mi_release;
};
rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
@@ -1217,7 +1217,7 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi)
if (mi->mi_modified && mi->mi_prevoffset) {
DBC * dbcursor = NULL;
xx = dbiCopen(dbi, &dbcursor, 0);
- dbiUpdateRecord(dbi, dbcursor, mi->mi_prevoffset, mi->mi_h);
+ (void) dbiUpdateRecord(dbi, dbcursor, mi->mi_prevoffset, mi->mi_h);
xx = dbiCclose(dbi, dbcursor, 0);
dbcursor = NULL;
}
@@ -1328,6 +1328,13 @@ top:
keylen = mi->mi_keylen;
rc = dbiGet(dbi, mi->mi_dbc, &keyp, &keylen, &uh, &uhlen, 0);
+if (dbi->dbi_api == 1 && dbi->dbi_rpmtag == RPMDBI_PACKAGES && rc == EFAULT) {
+ rpmError(RPMERR_INTERNAL,
+ _("record number %u in database is bad -- skipping.\n"), dbi->dbi_lastoffset);
+ if (keyp && dbi->dbi_lastoffset)
+ memcpy(&mi->mi_offset, keyp, sizeof(mi->mi_offset));
+ continue;
+}
/*
* If we got the next key, save the header instance number.
@@ -1359,23 +1366,25 @@ top:
/* Free current header */
if (mi->mi_h) {
if (mi->mi_modified && mi->mi_prevoffset)
- dbiUpdateRecord(dbi, mi->mi_dbc, mi->mi_prevoffset, mi->mi_h);
+ (void) dbiUpdateRecord(dbi, mi->mi_dbc, mi->mi_prevoffset, mi->mi_h);
headerFree(mi->mi_h);
mi->mi_h = NULL;
}
mi->mi_h = headerCopyLoad(uh);
+ /* XXX db1 with hybrid, simulated db interface on falloc.c needs free. */
+ if (dbi->dbi_api <= 1) free(uh);
if (mi->mi_release) {
const char *release;
- headerNVR(mi->mi_h, NULL, NULL, &release);
+ (void) headerNVR(mi->mi_h, NULL, NULL, &release);
if (strcmp(mi->mi_release, release))
goto top;
}
if (mi->mi_version) {
const char *version;
- headerNVR(mi->mi_h, NULL, &version, NULL);
+ (void) headerNVR(mi->mi_h, NULL, &version, NULL);
if (strcmp(mi->mi_version, version))
goto top;
}
@@ -1456,7 +1465,7 @@ int rpmdbPruneIterator(rpmdbMatchIterator mi, int * hdrNums,
return 1;
if (mi->mi_set)
- dbiPruneSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), sorted);
+ (void) dbiPruneSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), sorted);
return 0;
}
@@ -1467,7 +1476,7 @@ int rpmdbAppendIterator(rpmdbMatchIterator mi, const int * hdrNums, int nHdrNums
if (mi->mi_set == NULL)
mi->mi_set = xcalloc(1, sizeof(*mi->mi_set));
- dbiAppendSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), 0);
+ (void) dbiAppendSet(mi->mi_set, hdrNums, nHdrNums, sizeof(*hdrNums), 0);
return 0;
}
@@ -1622,11 +1631,11 @@ int rpmdbRemove(rpmdb rpmdb, int rid, unsigned int hdrNum)
/* Add remove transaction id to header. */
if (rid > 0) {
int_32 tid = rid;
- headerAddEntry(h, RPMTAG_REMOVETID, RPM_INT32_TYPE, &tid, 1);
+ (void) headerAddEntry(h, RPMTAG_REMOVETID, RPM_INT32_TYPE, &tid, 1);
}
{ const char *n, *v, *r;
- headerNVR(h, &n, &v, &r);
+ (void) headerNVR(h, &n, &v, &r);
rpmMessage(RPMMESS_DEBUG, " --- %10u %s-%s-%s\n", hdrNum, n, v, r);
}
@@ -1783,7 +1792,7 @@ static INLINE int addIndexEntry(dbiIndex dbi, DBC * dbcursor,
rc = 0;
set = xcalloc(1, sizeof(*set));
}
- dbiAppendSet(set, rec, 1, sizeof(*rec), 0);
+ (void) dbiAppendSet(set, rec, 1, sizeof(*rec), 0);
if (dbiUpdateIndex(dbi, dbcursor, keyp, keylen, set))
rc = 1;
}
@@ -1813,8 +1822,8 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
if (iid > 0) {
int_32 tid = iid;
- headerRemoveEntry(h, RPMTAG_REMOVETID);
- headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
+ (void) headerRemoveEntry(h, RPMTAG_REMOVETID);
+ (void) headerAddEntry(h, RPMTAG_INSTALLTID, RPM_INT32_TYPE, &tid, 1);
}
/*
@@ -1823,7 +1832,7 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
* being written to the package header database.
*/
- hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count);
+ (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, &count);
if (_noDirTokens)
expandFilelist(h);
@@ -1912,7 +1921,7 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
if (!dbi->dbi_no_dbsync)
xx = dbiSync(dbi, 0);
{ const char *n, *v, *r;
- headerNVR(h, &n, &v, &r);
+ (void) headerNVR(h, &n, &v, &r);
rpmMessage(RPMMESS_DEBUG, " +++ %10u %s-%s-%s\n", hdrNum, n, v, r);
}
continue;
@@ -1924,11 +1933,11 @@ int rpmdbAdd(rpmdb rpmdb, int iid, Header h)
rpmcnt = count;
break;
case RPMTAG_REQUIRENAME:
- hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
- hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
+ (void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
+ (void) hge(h, RPMTAG_REQUIREFLAGS, NULL, (void **)&requireFlags, NULL);
break;
default:
- hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
+ (void) hge(h, rpmtag, &rpmtype, (void **)&rpmvals, &rpmcnt);
break;
}
@@ -2066,7 +2075,7 @@ int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, dbiIndexSet * matchList,
/* Gather all matches from the database */
for (i = 0; i < numItems; i++) {
- rpmdbGrowIterator(mi, fpList[i].baseName, 0, i);
+ (void) rpmdbGrowIterator(mi, fpList[i].baseName, 0, i);
matchList[i] = xcalloc(1, sizeof(*(matchList[i])));
}
@@ -2104,9 +2113,9 @@ int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, dbiIndexSet * matchList,
num = end - start;
/* Compute fingerprints for this header's matches */
- hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL);
- hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
- hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL);
+ (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &fullBaseNames, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fullDirIndexes, NULL);
baseNames = xcalloc(num, sizeof(*baseNames));
dirIndexes = xcalloc(num, sizeof(*dirIndexes));
@@ -2122,7 +2131,7 @@ int rpmdbFindFpList(rpmdb rpmdb, fingerPrint * fpList, dbiIndexSet * matchList,
for (i = 0; i < num; i++, im++) {
if (FP_EQUAL(fps[i], fpList[im->fpNum]))
/*@-usedef@*/
- dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
+ (void) dbiAppendSet(matchList[im->fpNum], im, 1, sizeof(*im), 0);
/*@=usedef@*/
}
@@ -2442,7 +2451,7 @@ int rpmdbRebuild(const char * rootdir)
const char * name, * version, * release;
int skip = 0;
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
/*@-shadow@*/
{ rpmdbMatchIterator mi;
@@ -2485,14 +2494,14 @@ int rpmdbRebuild(const char * rootdir)
olddb->db_remove_env = 1;
newdb->db_remove_env = 1;
}
- rpmdbClose(olddb);
- rpmdbClose(newdb);
+ (void) rpmdbClose(olddb);
+ (void) rpmdbClose(newdb);
if (failed) {
rpmMessage(RPMMESS_NORMAL, _("failed to rebuild database: original database "
"remains in place\n"));
- rpmdbRemoveDatabase(rootdir, newdbpath, _dbapi_rebuild);
+ (void) rpmdbRemoveDatabase(rootdir, newdbpath, _dbapi_rebuild);
rc = 1;
goto exit;
} else if (!nocleanup) {
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index f2834f27b..0debbbd0f 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -48,32 +48,32 @@ static void printHash(const unsigned long amount, const unsigned long total)
#ifdef FANCY_HASH
if (isatty (STDOUT_FILENO)) {
int i;
- for (i = 0; i < hashesPrinted; i++) putchar ('#');
- for (; i < hashesTotal; i++) putchar (' ');
+ for (i = 0; i < hashesPrinted; i++) (void) putchar ('#');
+ for (; i < hashesTotal; i++) (void) putchar (' ');
printf ("(%3d%%)",
(int)(100 * (total ? (((float) amount) / total) : 1)));
- for (i = 0; i < (hashesTotal + 6); i++) putchar ('\b');
+ for (i = 0; i < (hashesTotal + 6); i++) (void) putchar ('\b');
} else
#endif
fprintf(stdout, "#");
hashesPrinted++;
}
- fflush(stdout);
+ (void) fflush(stdout);
hashesPrinted = hashesNeeded;
if (hashesPrinted == hashesTotal) {
#ifdef FANCY_HASH
int i;
progressCurrent++;
- for (i = 1; i < hashesPrinted; i++) putchar ('#');
+ for (i = 1; i < hashesPrinted; i++) (void) putchar ('#');
printf (" [%3d%%]\n", (int)(100 * (progressTotal ?
(((float) progressCurrent) / progressTotal) : 1)));
#else
fprintf (stdout, "\n");
#endif
}
- fflush(stdout);
+ (void) fflush(stdout);
}
}
@@ -102,7 +102,7 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
case RPMCALLBACK_INST_CLOSE_FILE:
fd = fdFree(fd, "persist (showProgress)");
if (fd) {
- Fclose(fd);
+ (void) Fclose(fd);
fd = NULL;
}
break;
@@ -120,12 +120,12 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
#else
fprintf(stdout, "%-28s", s);
#endif
- fflush(stdout);
+ (void) fflush(stdout);
} else {
s = headerSprintf(h, "%{NAME}-%{VERSION}-%{RELEASE}",
rpmTagTable, rpmHeaderFormats, NULL);
fprintf(stdout, "%s\n", s);
- fflush(stdout);
+ (void) fflush(stdout);
}
s = _free(s);
break;
@@ -138,7 +138,7 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
: 100.0));
else if (flags & INSTALL_HASH)
printHash(amount, total);
- fflush(stdout);
+ (void) fflush(stdout);
break;
case RPMCALLBACK_TRANS_START:
@@ -153,7 +153,7 @@ static void * showProgress(const void * arg, const rpmCallbackType what,
fprintf(stdout, "%-28s", _("Preparing..."));
else
printf("%s\n", _("Preparing packages for installation..."));
- fflush(stdout);
+ (void) fflush(stdout);
break;
case RPMCALLBACK_TRANS_STOP:
@@ -312,13 +312,13 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
Fstrerror(fd));
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
numFailed++; *fnp = NULL;
continue;
}
rpmrc = rpmReadPackageHeader(fd, &h, &isSource, NULL, NULL);
- Fclose(fd);
+ (void) Fclose(fd);
if (rpmrc == RPMRC_FAIL || rpmrc == RPMRC_SHORTREAD) {
numFailed++; *fnp = NULL;
@@ -367,7 +367,7 @@ restart:
paths = headerFreeData(paths, pft);
} else {
const char * name;
- headerNVR(h, &name, NULL, NULL);
+ (void) headerNVR(h, &name, NULL, NULL);
rpmMessage(RPMMESS_ERROR,
_("package %s is not relocateable\n"), name);
numFailed++;
@@ -383,7 +383,7 @@ restart:
Header oldH;
int count;
- headerNVR(h, &name, NULL, NULL);
+ (void) headerNVR(h, &name, NULL, NULL);
mi = rpmdbInitIterator(db, RPMTAG_NAME, name, 0);
count = rpmdbGetIteratorCount(mi);
while ((oldH = rpmdbNextIterator(mi)) != NULL) {
@@ -443,7 +443,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *fnp,
Fstrerror(fd));
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
numFailed++; *fnp = NULL;
break;
}
@@ -453,7 +453,7 @@ restart:
if (rc)
rpmError(RPMERR_MANIFEST, _("%s: read manifest failed: %s\n"),
fileURL, Fstrerror(fd));
- Fclose(fd);
+ (void) Fclose(fd);
/* If successful, restart the query loop. */
if (rc == 0) {
@@ -521,7 +521,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmMessage(RPMMESS_ERROR, _("cannot open file %s: %s\n"),
sourceURL[i], Fstrerror(fd));
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
continue;
}
@@ -531,7 +531,7 @@ restart:
if (rpmrc != RPMRC_OK) numFailed++;
}
- Fclose(fd);
+ (void) Fclose(fd);
}
}
@@ -539,13 +539,13 @@ exit:
if (ts) rpmtransFree(ts);
for (i = 0; i < numPkgs; i++) {
if (pkgState[i] == 1)
- Unlink(pkgURL[i]);
+ (void) Unlink(pkgURL[i]);
pkgURL[i] = _free(pkgURL[i]);
}
pkgState = _free(pkgState);
pkgURL = _free(pkgURL);
argv = _free(argv);
- if (dbIsOpen) rpmdbClose(db);
+ if (dbIsOpen) (void) rpmdbClose(db);
return numFailed;
}
@@ -628,7 +628,7 @@ int rpmErase(const char * rootdir, const char ** argv,
}
rpmtransFree(ts);
- rpmdbClose(db);
+ (void) rpmdbClose(db);
return numFailed;
}
@@ -642,7 +642,7 @@ int rpmInstallSource(const char * rootdir, const char * arg,
fd = Fopen(arg, "r.ufdio");
if (fd == NULL || Ferror(fd)) {
rpmMessage(RPMMESS_ERROR, _("cannot open %s: %s\n"), arg, Fstrerror(fd));
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
return 1;
}
@@ -663,7 +663,7 @@ int rpmInstallSource(const char * rootdir, const char * arg,
/*@=unqualifiedtrans@*/
}
- Fclose(fd);
+ (void) Fclose(fd);
return rc;
}
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index 98eda9838..5b3dead25 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -612,7 +612,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
{ off_t size = fdSize(fd);
size_t nb = (size >= 0 ? size : (8*BUFSIZ - 2));
if (nb == 0) {
- Fclose(fd);
+ (void) Fclose(fd);
return 0;
}
next = alloca(nb + 2);
@@ -624,7 +624,7 @@ static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
rc = 1;
} else
rc = 0;
- Fclose(fd);
+ (void) Fclose(fd);
if (rc) return rc;
next[nb] = '\n';
next[nb + 1] = '\0';
@@ -962,7 +962,7 @@ static void defaultMachine(/*@out@*/ const char ** arch, /*@out@*/ const char **
const struct canonEntry * canon;
if (!gotDefaults) {
- uname(&un);
+ (void) uname(&un);
#if !defined(__linux__)
#ifdef SNI
@@ -1017,7 +1017,7 @@ static void defaultMachine(/*@out@*/ const char ** arch, /*@out@*/ const char **
if (!Ferror(fd)) {
chptr = xcalloc(1, 256);
{ int irelid = Fread(chptr, sizeof(*chptr), 256, fd);
- Fclose(fd);
+ (void) Fclose(fd);
/* example: "112393 RELEASE 020200 Version 01 OS" */
if (irelid > 0) {
if ((prelid = strstr(chptr, "RELEASE "))){
diff --git a/lib/signature.c b/lib/signature.c
index 908319a7f..99eab6539 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -162,7 +162,7 @@ rpmRC rpmReadSignature(FD_t fd, Header * headerp, sigType sig_type)
if (timedRead(fd, buf, 256) != 256)
break;
h = headerNew();
- headerAddEntry(h, RPMSIGTAG_PGP, RPM_BIN_TYPE, buf, 152);
+ (void) headerAddEntry(h, RPMSIGTAG_PGP, RPM_BIN_TYPE, buf, 152);
rc = RPMRC_OK;
break;
case RPMSIGTYPE_MD5:
@@ -248,7 +248,7 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
(void) stpcpy( stpcpy(sigfile, file), ".sig");
inpipe[0] = inpipe[1] = 0;
- pipe(inpipe);
+ (void) pipe(inpipe);
if (!(pid = fork())) {
const char *pgp_path = rpmExpand("%{_pgp_path}", NULL);
@@ -256,24 +256,24 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
const char *path;
pgpVersion pgpVer;
- close(STDIN_FILENO);
- dup2(inpipe[0], 3);
- close(inpipe[1]);
+ (void) close(STDIN_FILENO);
+ (void) dup2(inpipe[0], 3);
+ (void) close(inpipe[1]);
- dosetenv("PGPPASSFD", "3", 1);
+ (void) dosetenv("PGPPASSFD", "3", 1);
if (pgp_path && *pgp_path != '%')
- dosetenv("PGPPATH", pgp_path, 1);
+ (void) dosetenv("PGPPATH", pgp_path, 1);
/* dosetenv("PGPPASS", passPhrase, 1); */
if ((path = rpmDetectPGPVersion(&pgpVer)) != NULL) {
switch(pgpVer) {
case PGP_2:
- execlp(path, "pgp", "+batchmode=on", "+verbose=0", "+armor=off",
+ (void) execlp(path, "pgp", "+batchmode=on", "+verbose=0", "+armor=off",
name, "-sb", file, sigfile, NULL);
break;
case PGP_5:
- execlp(path,"pgps", "+batchmode=on", "+verbose=0", "+armor=off",
+ (void) execlp(path,"pgps", "+batchmode=on", "+verbose=0", "+armor=off",
name, "-b", file, "-o", sigfile, NULL);
break;
case PGP_UNKNOWN:
@@ -285,10 +285,10 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
_exit(RPMERR_EXEC);
}
- close(inpipe[0]);
- (void)write(inpipe[1], passPhrase, strlen(passPhrase));
- (void)write(inpipe[1], "\n", 1);
- close(inpipe[1]);
+ (void) close(inpipe[0]);
+ (void) write(inpipe[1], passPhrase, strlen(passPhrase));
+ (void) write(inpipe[1], "\n", 1);
+ (void) close(inpipe[1]);
(void)waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
@@ -298,7 +298,7 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
if (stat(sigfile, &st)) {
/* PGP failed to write signature */
- unlink(sigfile); /* Just in case */
+ (void) unlink(sigfile); /* Just in case */
rpmError(RPMERR_SIGGEN, _("pgp failed to write signature\n"));
return 1;
}
@@ -311,10 +311,10 @@ static int makePGPSignature(const char * file, /*@out@*/ void ** sig,
int rc;
fd = Fopen(sigfile, "r.fdio");
rc = timedRead(fd, *sig, *size);
- unlink(sigfile);
- Fclose(fd);
+ (void) unlink(sigfile);
+ (void) Fclose(fd);
if (rc != *size) {
- free(*sig);
+ *sig = _free(*sig);
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1;
}
@@ -342,19 +342,19 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
(void) stpcpy( stpcpy(sigfile, file), ".sig");
inpipe[0] = inpipe[1] = 0;
- pipe(inpipe);
+ (void) pipe(inpipe);
if (!(pid = fork())) {
const char *gpg_path = rpmExpand("%{_gpg_path}", NULL);
const char *name = rpmExpand("%{_gpg_name}", NULL);
- close(STDIN_FILENO);
- dup2(inpipe[0], 3);
- close(inpipe[1]);
+ (void) close(STDIN_FILENO);
+ (void) dup2(inpipe[0], 3);
+ (void) close(inpipe[1]);
if (gpg_path && *gpg_path != '%')
- dosetenv("GNUPGHOME", gpg_path, 1);
- execlp("gpg", "gpg",
+ (void) dosetenv("GNUPGHOME", gpg_path, 1);
+ (void) execlp("gpg", "gpg",
"--batch", "--no-verbose", "--no-armor", "--passphrase-fd", "3",
"-u", name, "-sbo", sigfile, file,
NULL);
@@ -363,9 +363,9 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
}
fpipe = fdopen(inpipe[1], "w");
- close(inpipe[0]);
+ (void) close(inpipe[0]);
fprintf(fpipe, "%s\n", passPhrase);
- fclose(fpipe);
+ (void) fclose(fpipe);
(void)waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
@@ -375,7 +375,7 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
if (stat(sigfile, &st)) {
/* GPG failed to write signature */
- unlink(sigfile); /* Just in case */
+ (void) unlink(sigfile); /* Just in case */
rpmError(RPMERR_SIGGEN, _("gpg failed to write signature\n"));
return 1;
}
@@ -388,10 +388,10 @@ static int makeGPGSignature(const char * file, /*@out@*/ void ** sig,
int rc;
fd = Fopen(sigfile, "r.fdio");
rc = timedRead(fd, *sig, *size);
- unlink(sigfile);
- Fclose(fd);
+ (void) unlink(sigfile);
+ (void) Fclose(fd);
if (rc != *size) {
- free(*sig);
+ *sig = _free(*sig);
rpmError(RPMERR_SIGGEN, _("unable to read the signature\n"));
return 1;
}
@@ -413,28 +413,28 @@ int rpmAddSignature(Header header, const char * file, int_32 sigTag,
switch (sigTag) {
case RPMSIGTAG_SIZE:
- stat(file, &st);
+ (void) stat(file, &st);
size = st.st_size;
ret = 0;
- headerAddEntry(header, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1);
+ (void) headerAddEntry(header, RPMSIGTAG_SIZE, RPM_INT32_TYPE, &size, 1);
break;
case RPMSIGTAG_MD5:
ret = mdbinfile(file, buf);
if (ret == 0)
- headerAddEntry(header, sigTag, RPM_BIN_TYPE, buf, 16);
+ (void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, buf, 16);
break;
case RPMSIGTAG_PGP5: /* XXX legacy */
case RPMSIGTAG_PGP:
rpmMessage(RPMMESS_VERBOSE, _("Generating signature using PGP.\n"));
ret = makePGPSignature(file, &sig, &size, passPhrase);
if (ret == 0)
- headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
+ (void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
break;
case RPMSIGTAG_GPG:
rpmMessage(RPMMESS_VERBOSE, _("Generating signature using GPG.\n"));
ret = makeGPGSignature(file, &sig, &size, passPhrase);
if (ret == 0)
- headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
+ (void) headerAddEntry(header, sigTag, RPM_BIN_TYPE, sig, size);
break;
}
@@ -446,7 +446,7 @@ verifySizeSignature(const char * datafile, int_32 size, char * result)
{
struct stat st;
- stat(datafile, &st);
+ (void) stat(datafile, &st);
if (size != st.st_size) {
sprintf(result, "Header+Archive size mismatch.\n"
"Expected %d, saw %d.\n",
@@ -466,7 +466,7 @@ verifyMD5Signature(const char * datafile, const byte * sig,
{
byte md5sum[16];
- fn(datafile, md5sum);
+ (void) fn(datafile, md5sum);
if (memcmp(md5sum, sig, 16)) {
sprintf(result, "MD5 sum mismatch\n"
"Expected: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x"
@@ -529,21 +529,21 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
}
sfd = Fopen(sigfile, "w.fdio");
(void)Fwrite(sig, sizeof(char), count, sfd);
- Fclose(sfd);
+ (void) Fclose(sfd);
/* Now run PGP */
outpipe[0] = outpipe[1] = 0;
- pipe(outpipe);
+ (void) pipe(outpipe);
if (!(pid = fork())) {
const char *pgp_path = rpmExpand("%{_pgp_path}", NULL);
- close(outpipe[0]);
- close(STDOUT_FILENO); /* XXX unnecessary */
- dup2(outpipe[1], STDOUT_FILENO);
+ (void) close(outpipe[0]);
+ (void) close(STDOUT_FILENO); /* XXX unnecessary */
+ (void) dup2(outpipe[1], STDOUT_FILENO);
if (pgp_path && *pgp_path != '%')
- dosetenv("PGPPATH", pgp_path, 1);
+ (void) dosetenv("PGPPATH", pgp_path, 1);
switch (pgpVer) {
case PGP_5:
@@ -551,19 +551,19 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
/* another message") is _always_ written to stderr; we */
/* want to catch that output, so dup stdout to stderr: */
{ int save_stderr = dup(2);
- dup2(1, 2);
- execlp(path, "pgpv", "+batchmode=on", "+verbose=0",
+ (void) dup2(1, 2);
+ (void) execlp(path, "pgpv", "+batchmode=on", "+verbose=0",
/* Write "Good signature..." to stdout: */
"+OutputInformationFD=1",
/* Write "WARNING: ... is not trusted to... to stdout: */
"+OutputWarningFD=1",
sigfile, "-o", datafile, NULL);
/* Restore stderr so we can print the error message below. */
- dup2(save_stderr, 2);
- close(save_stderr);
+ (void) dup2(save_stderr, 2);
+ (void) close(save_stderr);
} break;
case PGP_2:
- execlp(path, "pgp", "+batchmode=on", "+verbose=0",
+ (void) execlp(path, "pgp", "+batchmode=on", "+verbose=0",
sigfile, datafile, NULL);
break;
case PGP_UNKNOWN:
@@ -576,7 +576,7 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
_exit(RPMERR_EXEC);
}
- close(outpipe[1]);
+ (void) close(outpipe[1]);
file = fdopen(outpipe[0], "r");
result[0] = '\0';
while (fgets(buf, 1024, file)) {
@@ -595,10 +595,10 @@ verifyPGPSignature(const char * datafile, const void * sig, int count,
else if (!strncmp("Good signature", buf, 14))
res = RPMSIG_OK;
}
- fclose(file);
+ (void) fclose(file);
- (void)waitpid(pid, &status, 0);
- unlink(sigfile);
+ (void) waitpid(pid, &status, 0);
+ (void) unlink(sigfile);
if (!res && (!WIFEXITED(status) || WEXITSTATUS(status))) {
res = RPMSIG_BAD;
}
@@ -623,24 +623,24 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
tmppath = _free(tmppath);
}
sfd = Fopen(sigfile, "w.fdio");
- (void)Fwrite(sig, sizeof(char), count, sfd);
- Fclose(sfd);
+ (void) Fwrite(sig, sizeof(char), count, sfd);
+ (void) Fclose(sfd);
/* Now run GPG */
outpipe[0] = outpipe[1] = 0;
- pipe(outpipe);
+ (void) pipe(outpipe);
if (!(pid = fork())) {
const char *gpg_path = rpmExpand("%{_gpg_path}", NULL);
- close(outpipe[0]);
+ (void) close(outpipe[0]);
/* gpg version 0.9 sends its output to stderr. */
- dup2(outpipe[1], STDERR_FILENO);
+ (void) dup2(outpipe[1], STDERR_FILENO);
if (gpg_path && *gpg_path != '%')
- dosetenv("GNUPGHOME", gpg_path, 1);
+ (void) dosetenv("GNUPGHOME", gpg_path, 1);
- execlp("gpg", "gpg",
+ (void) execlp("gpg", "gpg",
"--batch", "--no-verbose",
"--verify", sigfile, datafile,
NULL);
@@ -649,7 +649,7 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
_exit(RPMERR_EXEC);
}
- close(outpipe[1]);
+ (void) close(outpipe[1]);
file = fdopen(outpipe[0], "r");
result[0] = '\0';
while (fgets(buf, 1024, file)) {
@@ -658,10 +658,10 @@ verifyGPGSignature(const char * datafile, const void * sig, int count,
res = RPMSIG_NOKEY;
}
}
- fclose(file);
+ (void) fclose(file);
- (void)waitpid(pid, &status, 0);
- unlink(sigfile);
+ (void) waitpid(pid, &status, 0);
+ (void) unlink(sigfile);
if (!res && (!WIFEXITED(status) || WEXITSTATUS(status))) {
res = RPMSIG_BAD;
}
@@ -676,31 +676,31 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
int fd;
passPhrasePipe[0] = passPhrasePipe[1] = 0;
- pipe(passPhrasePipe);
+ (void) pipe(passPhrasePipe);
if (!(pid = fork())) {
- close(STDIN_FILENO);
- close(STDOUT_FILENO);
- close(passPhrasePipe[1]);
+ (void) close(STDIN_FILENO);
+ (void) close(STDOUT_FILENO);
+ (void) close(passPhrasePipe[1]);
if (! rpmIsVerbose()) {
- close(STDERR_FILENO);
+ (void) close(STDERR_FILENO);
}
if ((fd = open("/dev/null", O_RDONLY)) != STDIN_FILENO) {
- dup2(fd, STDIN_FILENO);
- close(fd);
+ (void) dup2(fd, STDIN_FILENO);
+ (void) close(fd);
}
if ((fd = open("/dev/null", O_WRONLY)) != STDOUT_FILENO) {
- dup2(fd, STDOUT_FILENO);
- close(fd);
+ (void) dup2(fd, STDOUT_FILENO);
+ (void) close(fd);
}
- dup2(passPhrasePipe[0], 3);
+ (void) dup2(passPhrasePipe[0], 3);
switch (sigTag) {
case RPMSIGTAG_GPG:
{ const char *gpg_path = rpmExpand("%{_gpg_path}", NULL);
const char *name = rpmExpand("%{_gpg_name}", NULL);
if (gpg_path && *gpg_path != '%')
- dosetenv("GNUPGHOME", gpg_path, 1);
- execlp("gpg", "gpg",
+ (void) dosetenv("GNUPGHOME", gpg_path, 1);
+ (void) execlp("gpg", "gpg",
"--batch", "--no-verbose", "--passphrase-fd", "3",
"-u", name, "-so", "-",
NULL);
@@ -714,18 +714,18 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
const char *path;
pgpVersion pgpVer;
- dosetenv("PGPPASSFD", "3", 1);
+ (void) dosetenv("PGPPASSFD", "3", 1);
if (pgp_path && *pgp_path != '%')
- dosetenv("PGPPATH", pgp_path, 1);
+ (void) dosetenv("PGPPATH", pgp_path, 1);
if ((path = rpmDetectPGPVersion(&pgpVer)) != NULL) {
switch(pgpVer) {
case PGP_2:
- execlp(path, "pgp", "+batchmode=on", "+verbose=0",
+ (void) execlp(path, "pgp", "+batchmode=on", "+verbose=0",
name, "-sf", NULL);
break;
case PGP_5: /* XXX legacy */
- execlp(path,"pgps", "+batchmode=on", "+verbose=0",
+ (void) execlp(path,"pgps", "+batchmode=on", "+verbose=0",
name, "-f", NULL);
break;
case PGP_UNKNOWN:
@@ -743,10 +743,10 @@ static int checkPassPhrase(const char * passPhrase, const int sigTag)
}
}
- close(passPhrasePipe[0]);
- (void)write(passPhrasePipe[1], passPhrase, strlen(passPhrase));
- (void)write(passPhrasePipe[1], "\n", 1);
- close(passPhrasePipe[1]);
+ (void) close(passPhrasePipe[0]);
+ (void) write(passPhrasePipe[1], passPhrase, strlen(passPhrase));
+ (void) write(passPhrasePipe[1], "\n", 1);
+ (void) close(passPhrasePipe[1]);
(void)waitpid(pid, &status, 0);
if (!WIFEXITED(status) || WEXITSTATUS(status)) {
diff --git a/lib/transaction.c b/lib/transaction.c
index cdc115182..3312f22d5 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -168,7 +168,7 @@ static void psAppend(rpmProblemSet probs, rpmProblemType type,
if (altH) {
const char * n, * v, * r;
- headerNVR(altH, &n, &v, &r);
+ (void) headerNVR(altH, &n, &v, &r);
p->altNEVR =
t = xmalloc(strlen(n) + strlen(v) + strlen(r) + sizeof("--"));
t = stpcpy(t, n);
@@ -186,7 +186,7 @@ static int archOkay(Header h)
int type, count;
/* make sure we're trying to install this on the proper architecture */
- headerGetEntry(h, RPMTAG_ARCH, &type, (void **) &pkgArch, &count);
+ (void) headerGetEntry(h, RPMTAG_ARCH, &type, (void **) &pkgArch, &count);
#ifndef DYING
if (type == RPM_INT8_TYPE) {
int_8 * pkgArchNum;
@@ -216,7 +216,7 @@ static int osOkay(Header h)
int type, count;
/* make sure we're trying to install this on the proper os */
- headerGetEntry(h, RPMTAG_OS, &type, (void **) &pkgOs, &count);
+ (void) headerGetEntry(h, RPMTAG_OS, &type, (void **) &pkgOs, &count);
#ifndef DYING
if (type == RPM_INT8_TYPE) {
/* v1 packages and v2 packages both used improper OS numbers, so just
@@ -338,7 +338,7 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
if (numRelocations == 0) {
if (numValid) {
if (!headerIsEntry(origH, RPMTAG_INSTPREFIXES))
- headerAddEntry(origH, RPMTAG_INSTPREFIXES,
+ (void) headerAddEntry(origH, RPMTAG_INSTPREFIXES,
validType, validRelocations, numValid);
validRelocations = hfd(validRelocations, validType);
}
@@ -447,18 +447,18 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
}
if (numActual)
- headerAddEntry(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
+ (void) headerAddEntry(h, RPMTAG_INSTPREFIXES, RPM_STRING_ARRAY_TYPE,
(void **) actualRelocations, numActual);
actualRelocations = _free(actualRelocations);
validRelocations = hfd(validRelocations, validType);
}
- hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount);
- hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
- hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount);
- hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL);
- hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL);
+ (void) hge(h, RPMTAG_BASENAMES, NULL, (void **) &baseNames, &fileCount);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &dirNames, &dirCount);
+ (void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fFlags, NULL);
+ (void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &fModes, NULL);
skipDirList = alloca(dirCount * sizeof(*skipDirList));
memset(skipDirList, 0, dirCount * sizeof(*skipDirList));
@@ -647,33 +647,33 @@ static Header relocateFileList(const rpmTransactionSet ts, TFI_t fi,
int t;
p = NULL;
- hge(h, RPMTAG_BASENAMES, &t, &p, &c);
- headerAddEntry(h, RPMTAG_ORIGBASENAMES, t, p, c);
+ (void) hge(h, RPMTAG_BASENAMES, &t, &p, &c);
+ (void) headerAddEntry(h, RPMTAG_ORIGBASENAMES, t, p, c);
p = hfd(p, t);
p = NULL;
- hge(h, RPMTAG_DIRNAMES, &t, &p, &c);
- headerAddEntry(h, RPMTAG_ORIGDIRNAMES, t, p, c);
+ (void) hge(h, RPMTAG_DIRNAMES, &t, &p, &c);
+ (void) headerAddEntry(h, RPMTAG_ORIGDIRNAMES, t, p, c);
p = hfd(p, t);
p = NULL;
- hge(h, RPMTAG_DIRINDEXES, &t, &p, &c);
- headerAddEntry(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
+ (void) hge(h, RPMTAG_DIRINDEXES, &t, &p, &c);
+ (void) headerAddEntry(h, RPMTAG_ORIGDIRINDEXES, t, p, c);
p = hfd(p, t);
- headerModifyEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerModifyEntry(h, RPMTAG_BASENAMES, RPM_STRING_ARRAY_TYPE,
baseNames, fileCount);
fi->bnl = hfd(fi->bnl, RPM_STRING_ARRAY_TYPE);
- hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
+ (void) hge(h, RPMTAG_BASENAMES, NULL, (void **) &fi->bnl, &fi->fc);
- headerModifyEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
+ (void) headerModifyEntry(h, RPMTAG_DIRNAMES, RPM_STRING_ARRAY_TYPE,
dirNames, dirCount);
fi->dnl = hfd(fi->dnl, RPM_STRING_ARRAY_TYPE);
- hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
+ (void) hge(h, RPMTAG_DIRNAMES, NULL, (void **) &fi->dnl, &fi->dc);
- headerModifyEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
+ (void) headerModifyEntry(h, RPMTAG_DIRINDEXES, RPM_INT32_TYPE,
dirIndexes, fileCount);
- hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &fi->dil, NULL);
}
baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
@@ -879,12 +879,12 @@ static int handleInstInstalledFiles(TFI_t fi, rpmdb db,
return 1;
}
- hge(h, RPMTAG_FILEMD5S, &omtype, (void **) &otherMd5s, NULL);
- hge(h, RPMTAG_FILELINKTOS, &oltype, (void **) &otherLinks, NULL);
- hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
- hge(h, RPMTAG_FILEMODES, NULL, (void **) &otherModes, NULL);
- hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL);
- hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL);
+ (void) hge(h, RPMTAG_FILEMD5S, &omtype, (void **) &otherMd5s, NULL);
+ (void) hge(h, RPMTAG_FILELINKTOS, &oltype, (void **) &otherLinks, NULL);
+ (void) hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
+ (void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &otherModes, NULL);
+ (void) hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &otherFlags, NULL);
+ (void) hge(h, RPMTAG_FILESIZES, NULL, (void **) &otherSizes, NULL);
fi->replaced = xmalloc(sharedCount * sizeof(*fi->replaced));
@@ -964,7 +964,7 @@ static int handleRmvdInstalledFiles(TFI_t fi, rpmdb db,
return 1;
}
- hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
+ (void) hge(h, RPMTAG_FILESTATES, NULL, (void **) &otherStates, NULL);
for (i = 0; i < sharedCount; i++, shared++) {
int otherFileNum, fileNum;
@@ -1023,7 +1023,7 @@ static void handleOverlappedFiles(TFI_t fi, hashTable ht,
* will be installed and removed so the records for an overlapped
* files will be sorted in exactly the same order.
*/
- htGetEntry(ht, &fi->fps[i], (const void ***) &recs, &numRecs, NULL);
+ (void) htGetEntry(ht, &fi->fps[i], (const void ***) &recs, &numRecs, NULL);
/*
* If this package is being added, look only at other packages
@@ -1540,7 +1540,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
ts->di[i].iavail = !(sfb.f_ffree == 0 && sfb.f_files == 0)
? sfb.f_ffree : -1;
- stat(ts->filesystems[i], &sb);
+ (void) stat(ts->filesystems[i], &sb);
ts->di[i].dev = sb.st_dev;
}
}
@@ -1574,7 +1574,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
Header oldH;
mi = rpmdbInitIterator(ts->rpmdb, RPMTAG_NAME, alp->name, 0);
while ((oldH = rpmdbNextIterator(mi)) != NULL)
- ensureOlder(alp, oldH, ts->probs);
+ (void) ensureOlder(alp, oldH, ts->probs);
mi = rpmdbFreeIterator(mi);
}
@@ -1604,7 +1604,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
int fileCount;
mi = rpmdbInitIterator(ts->rpmdb, RPMDBI_PACKAGES, NULL, 0);
- rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages);
+ (void) rpmdbAppendIterator(mi, ts->removedPackages, ts->numRemovedPackages);
while ((h = rpmdbNextIterator(mi)) != NULL) {
if (headerGetEntry(h, RPMTAG_BASENAMES, NULL, NULL, &fileCount))
totalFileCount += fileCount;
@@ -1675,10 +1675,10 @@ int rpmRunTransactions( rpmTransactionSet ts,
tsi = tsFreeIterator(tsi);
/* Open all database indices before installing. */
- rpmdbOpenAll(ts->rpmdb);
+ (void) rpmdbOpenAll(ts->rpmdb);
if (!ts->chrootDone) {
- chdir("/");
+ (void) chdir("/");
/*@-unrecog@*/ chroot(ts->rootDir); /*@=unrecog@*/
ts->chrootDone = 1;
}
@@ -1791,13 +1791,13 @@ int rpmRunTransactions( rpmTransactionSet ts,
/* Determine the fate of each file. */
switch (fi->type) {
case TR_ADDED:
- handleInstInstalledFiles(fi, ts->rpmdb, shared, nexti - i,
+ (void) handleInstInstalledFiles(fi, ts->rpmdb, shared, nexti - i,
!(beingRemoved || (ts->ignoreSet & RPMPROB_FILTER_REPLACEOLDFILES)),
ts->probs, ts->transFlags);
break;
case TR_REMOVED:
if (!beingRemoved)
- handleRmvdInstalledFiles(fi, ts->rpmdb, shared, nexti - i);
+ (void) handleRmvdInstalledFiles(fi, ts->rpmdb, shared, nexti - i);
break;
}
}
@@ -1842,7 +1842,7 @@ int rpmRunTransactions( rpmTransactionSet ts,
if (ts->chrootDone) {
/*@-unrecog@*/ chroot("."); /*@-unrecog@*/
ts->chrootDone = 0;
- chdir(ts->currDir);
+ (void) chdir(ts->currDir);
}
NOTIFY(ts, (NULL, RPMCALLBACK_TRANS_STOP, 6, ts->flEntries,
@@ -1953,7 +1953,7 @@ assert(alp == fi->ap);
if (alp->multiLib)
ts->transFlags |= RPMTRANS_FLAG_MULTILIB;
-if (fi->ap == NULL) fi->ap = alp; /* XXX WTFO? */
+assert(alp == fi->ap);
if (psmStage(psm, PSM_PKGINSTALL)) {
ourrc++;
lastFailed = i;
diff --git a/lib/verify.c b/lib/verify.c
index eb4acef2e..2dd413772 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -75,37 +75,31 @@ struct poptOption rpmVerifyPoptTable[] = {
int rpmVerifyFile(const char * prefix, Header h, int filenum,
int * result, int omitMask)
{
- char ** baseNames, ** md5List, ** linktoList, ** dirNames;
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
+ HFD_t hfd = headerFreeData;
int_32 * verifyFlags;
rpmVerifyAttrs flags;
- int_32 * sizeList, * mtimeList, * dirIndexes;
- unsigned short * modeList, * rdevList;
- char * fileStatesList;
+ unsigned short * modeList;
+ const char * fileStatesList;
char * filespec;
- char * name;
- gid_t gid;
- int type, count, rc;
+ int count;
+ int rc;
struct stat sb;
- unsigned char md5sum[40];
- int_32 * uidList, * gidList;
- char linkto[1024];
- int size;
- char ** unameList, ** gnameList;
int_32 useBrokenMd5;
if (IS_BIG_ENDIAN()) { /* XXX was ifdef WORDS_BIGENDIAN */
int_32 * brokenPtr;
- if (!headerGetEntry(h, RPMTAG_BROKENMD5, NULL, (void **) &brokenPtr, NULL)) {
- char * rpmVersion;
+ if (!hge(h, RPMTAG_BROKENMD5, NULL, (void **) &brokenPtr, NULL)) {
+ const char * rpmVersion;
- if (headerGetEntry(h, RPMTAG_RPMVERSION, NULL, (void **) &rpmVersion,
- NULL)) {
+ if (hge(h, RPMTAG_RPMVERSION, NULL, (void **) &rpmVersion, NULL)) {
useBrokenMd5 = ((rpmvercmp(rpmVersion, "2.3.3") >= 0) &&
(rpmvercmp(rpmVersion, "2.3.8") <= 0));
} else {
useBrokenMd5 = 1;
}
- headerAddEntry(h, RPMTAG_BROKENMD5, RPM_INT32_TYPE, &useBrokenMd5, 1);
+ (void) headerAddEntry(h, RPMTAG_BROKENMD5, RPM_INT32_TYPE,
+ &useBrokenMd5, 1);
} else {
useBrokenMd5 = *brokenPtr;
}
@@ -113,33 +107,38 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
useBrokenMd5 = 0;
}
- headerGetEntry(h, RPMTAG_FILEMODES, &type, (void **) &modeList, &count);
+ (void) hge(h, RPMTAG_FILEMODES, NULL, (void **) &modeList, &count);
- if (headerGetEntry(h, RPMTAG_FILEVERIFYFLAGS, &type, (void **) &verifyFlags,
- &count)) {
+ if (hge(h, RPMTAG_FILEVERIFYFLAGS, NULL, (void **) &verifyFlags, NULL)) {
flags = verifyFlags[filenum];
} else {
flags = RPMVERIFY_ALL;
}
- headerGetEntry(h, RPMTAG_BASENAMES, &type, (void **) &baseNames,
- &count);
- headerGetEntry(h, RPMTAG_DIRINDEXES, &type, (void **) &dirIndexes,
- NULL);
- headerGetEntry(h, RPMTAG_DIRNAMES, &type, (void **) &dirNames, NULL);
+ {
+ const char ** baseNames;
+ const char ** dirNames;
+ int_32 * dirIndexes;
+ int bnt, dnt;
+
+ (void) hge(h, RPMTAG_BASENAMES, &bnt, (void **) &baseNames, NULL);
+ (void) hge(h, RPMTAG_DIRINDEXES, NULL, (void **) &dirIndexes, NULL);
+ (void) hge(h, RPMTAG_DIRNAMES, &dnt, (void **) &dirNames, NULL);
- filespec = alloca(strlen(dirNames[dirIndexes[filenum]]) +
+ filespec = alloca(strlen(dirNames[dirIndexes[filenum]]) +
strlen(baseNames[filenum]) + strlen(prefix) + 5);
- sprintf(filespec, "%s/%s%s", prefix, dirNames[dirIndexes[filenum]],
+ sprintf(filespec, "%s/%s%s", prefix, dirNames[dirIndexes[filenum]],
baseNames[filenum]);
- free(baseNames);
- free(dirNames);
+ baseNames = hfd(baseNames, bnt);
+ dirNames = hfd(dirNames, dnt);
+ }
*result = 0;
/* Check to see if the file was installed - if not pretend all is OK */
- if (headerGetEntry(h, RPMTAG_FILESTATES, &type,
- (void **) &fileStatesList, &count) && fileStatesList) {
+ if (hge(h, RPMTAG_FILESTATES, NULL, (void **) &fileStatesList, NULL) &&
+ fileStatesList != NULL)
+ {
if (fileStatesList[filenum] == RPMFILE_STATE_NOTINSTALLED)
return 0;
}
@@ -175,7 +174,11 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
flags &= ~(omitMask | RPMVERIFY_LSTATFAIL|RPMVERIFY_READFAIL|RPMVERIFY_READLINKFAIL);
if (flags & RPMVERIFY_MD5) {
- headerGetEntry(h, RPMTAG_FILEMD5S, &type, (void **) &md5List, &count);
+ unsigned char md5sum[40];
+ const char ** md5List;
+ int mdt;
+
+ (void) hge(h, RPMTAG_FILEMD5S, &mdt, (void **) &md5List, NULL);
if (useBrokenMd5) {
rc = mdfileBroken(filespec, md5sum);
} else {
@@ -186,10 +189,16 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
*result |= (RPMVERIFY_READFAIL|RPMVERIFY_MD5);
else if (strcmp(md5sum, md5List[filenum]))
*result |= RPMVERIFY_MD5;
- free(md5List);
+ md5List = hfd(md5List, mdt);
}
+
if (flags & RPMVERIFY_LINKTO) {
- headerGetEntry(h, RPMTAG_FILELINKTOS, &type, (void **) &linktoList, &count);
+ char linkto[1024];
+ int size;
+ const char ** linktoList;
+ int ltt;
+
+ (void) hge(h, RPMTAG_FILELINKTOS, &ltt, (void **) &linktoList, NULL);
size = readlink(filespec, linkto, sizeof(linkto)-1);
if (size == -1)
*result |= (RPMVERIFY_READLINKFAIL|RPMVERIFY_LINKTO);
@@ -198,11 +207,13 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
if (strcmp(linkto, linktoList[filenum]))
*result |= RPMVERIFY_LINKTO;
}
- free(linktoList);
+ linktoList = hfd(linktoList, ltt);
}
if (flags & RPMVERIFY_FILESIZE) {
- headerGetEntry(h, RPMTAG_FILESIZES, &type, (void **) &sizeList, &count);
+ int_32 * sizeList;
+
+ (void) hge(h, RPMTAG_FILESIZES, NULL, (void **) &sizeList, NULL);
if (sizeList[filenum] != sb.st_size)
*result |= RPMVERIFY_FILESIZE;
}
@@ -221,28 +232,33 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
S_ISBLK(modeList[filenum]) != S_ISBLK(sb.st_mode)) {
*result |= RPMVERIFY_RDEV;
} else if (S_ISDEV(modeList[filenum]) && S_ISDEV(sb.st_mode)) {
- headerGetEntry(h, RPMTAG_FILERDEVS, NULL, (void **) &rdevList,
- NULL);
+ unsigned short * rdevList;
+ (void) hge(h, RPMTAG_FILERDEVS, NULL, (void **) &rdevList, NULL);
if (rdevList[filenum] != sb.st_rdev)
*result |= RPMVERIFY_RDEV;
}
}
if (flags & RPMVERIFY_MTIME) {
- headerGetEntry(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtimeList, NULL);
+ int_32 * mtimeList;
+
+ (void) hge(h, RPMTAG_FILEMTIMES, NULL, (void **) &mtimeList, NULL);
if (mtimeList[filenum] != sb.st_mtime)
*result |= RPMVERIFY_MTIME;
}
if (flags & RPMVERIFY_USER) {
- if (headerGetEntry(h, RPMTAG_FILEUSERNAME, NULL, (void **) &unameList,
- NULL)) {
+ const char * name;
+ const char ** unameList;
+ int_32 * uidList;
+ int unt;
+
+ if (hge(h, RPMTAG_FILEUSERNAME, &unt, (void **) &unameList, NULL)) {
name = uidToUname(sb.st_uid);
if (!name || strcmp(unameList[filenum], name))
*result |= RPMVERIFY_USER;
- free(unameList);
- } else if (headerGetEntry(h, RPMTAG_FILEUIDS, NULL, (void **) &uidList,
- &count)) {
+ unameList = hfd(unameList, unt);
+ } else if (hge(h, RPMTAG_FILEUIDS, NULL, (void **) &uidList, NULL)) {
if (uidList[filenum] != sb.st_uid)
*result |= RPMVERIFY_GROUP;
} else {
@@ -253,14 +269,17 @@ int rpmVerifyFile(const char * prefix, Header h, int filenum,
}
if (flags & RPMVERIFY_GROUP) {
- if (headerGetEntry(h, RPMTAG_FILEGROUPNAME, NULL, (void **) &gnameList,
- NULL)) {
- rc = gnameToGid(gnameList[filenum],&gid);
+ const char ** gnameList;
+ int_32 * gidList;
+ int gnt;
+ gid_t gid;
+
+ if (hge(h, RPMTAG_FILEGROUPNAME, &gnt, (void **) &gnameList, NULL)) {
+ rc = gnameToGid(gnameList[filenum], &gid);
if (rc || (gid != sb.st_gid))
*result |= RPMVERIFY_GROUP;
- free(gnameList);
- } else if (headerGetEntry(h, RPMTAG_FILEGIDS, NULL, (void **) &gidList,
- &count)) {
+ gnameList = hfd(gnameList, gnt);
+ } else if (hge(h, RPMTAG_FILEGIDS, NULL, (void **) &gidList, NULL)) {
if (gidList[filenum] != sb.st_gid)
*result |= RPMVERIFY_GROUP;
} else {
@@ -309,6 +328,7 @@ int rpmVerifyScript(const char * rootDir, Header h, FD_t scriptFd)
/* ======================================================================== */
static int verifyHeader(QVA_t *qva, Header h)
{
+ HGE_t hge = (HGE_t)headerGetEntryMinMemory;
char buf[BUFSIZ];
char * t, * te;
@@ -324,7 +344,7 @@ static int verifyHeader(QVA_t *qva, Header h)
te = t = buf;
*te = '\0';
- if (!headerGetEntry(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlagsList, NULL))
+ if (!hge(h, RPMTAG_FILEFLAGS, NULL, (void **) &fileFlagsList, NULL))
goto exit;
if (!headerIsEntry(h, RPMTAG_BASENAMES))
@@ -400,16 +420,16 @@ static int verifyDependencies(rpmdb rpmdb, Header h)
int i;
rpmdep = rpmtransCreateSet(rpmdb, NULL);
- rpmtransAddPackage(rpmdep, h, NULL, NULL, 0, NULL);
+ (void) rpmtransAddPackage(rpmdep, h, NULL, NULL, 0, NULL);
- rpmdepCheck(rpmdep, &conflicts, &numConflicts);
+ (void) rpmdepCheck(rpmdep, &conflicts, &numConflicts);
rpmtransFree(rpmdep);
if (numConflicts) {
const char * name, * version, * release;
char * t, * te;
int nb = 512;
- headerNVR(h, &name, &version, &release);
+ (void) headerNVR(h, &name, &version, &release);
for (i = 0; i < numConflicts; i++) {
nb += strlen(conflicts[i].needsName) + sizeof(", ") - 1;
@@ -463,7 +483,7 @@ int showVerifyPackage(QVA_t *qva, rpmdb rpmdb, Header h)
if ((qva->qva_flags & VERIFY_SCRIPT) &&
(rc = rpmVerifyScript(qva->qva_prefix, h, fdo)) != 0)
ec = rc;
- Fclose(fdo);
+ (void) Fclose(fdo);
return ec;
}
@@ -486,7 +506,7 @@ int rpmVerify(QVA_t *qva, rpmQVSources source, const char *arg)
rc = rpmQueryVerify(qva, source, arg, rpmdb, showVerifyPackage);
if (rpmdb != NULL)
- rpmdbClose(rpmdb);
+ (void) rpmdbClose(rpmdb);
return rc;
}