diff options
author | jbj <devnull@localhost> | 2002-08-03 22:31:39 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2002-08-03 22:31:39 +0000 |
commit | 00375ca2bf6017f6fb652558776fb588e9df142f (patch) | |
tree | f1f75e2bcab8556463ace89066ab8b62255bc69b | |
parent | f5c9fd111bf2d68bff373738310bfc355577233b (diff) | |
download | librpm-tizen-00375ca2bf6017f6fb652558776fb588e9df142f.tar.gz librpm-tizen-00375ca2bf6017f6fb652558776fb588e9df142f.tar.bz2 librpm-tizen-00375ca2bf6017f6fb652558776fb588e9df142f.zip |
Remove dbi_tear_down, now that rpmdb's are closed on signals.
lclint fiddles.
CVS patchset: 5596
CVS date: 2002/08/03 22:31:39
-rw-r--r-- | build/files.c | 22 | ||||
-rw-r--r-- | lib/poptQV.c | 4 | ||||
-rw-r--r-- | lib/rpmds.c | 4 | ||||
-rw-r--r-- | lib/rpmds.h | 4 | ||||
-rw-r--r-- | lib/verify.c | 5 | ||||
-rw-r--r-- | rpmdb/db3.c | 2 | ||||
-rw-r--r-- | rpmdb/dbconfig.c | 10 | ||||
-rw-r--r-- | rpmdb/rpmdb.c | 73 | ||||
-rw-r--r-- | rpmdb/rpmdb.h | 13 | ||||
-rw-r--r-- | rpmio/rpmpgp.c | 8 | ||||
-rwxr-xr-x | rpmqv.c | 4 |
11 files changed, 91 insertions, 58 deletions
diff --git a/build/files.c b/build/files.c index f8c0cdfa7..d07fb3855 100644 --- a/build/files.c +++ b/build/files.c @@ -96,7 +96,9 @@ typedef struct AttrRec_s { static int multiLib = 0; /* MULTILIB */ /* list of files */ +/*@unchecked@*/ /*@only@*/ /*@null@*/ static StringBuf check_fileList = NULL; +/*@unchecked@*/ static int check_fileListLen = 0; /** @@ -1509,11 +1511,13 @@ static /*@null@*/ FileListRec freeFileList(/*@only@*/ FileListRec fileList, /*@-boundswrite@*/ static int addFile(FileList fl, const char * diskURL, /*@null@*/ struct stat * statp) - /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@globals check_fileList, check_fileListLen, rpmGlobalMacroContext, + fileSystem, internalState @*/ /*@modifies *statp, *fl, fl->processingFailed, fl->fileList, fl->fileListRecsAlloced, fl->fileListRecsUsed, fl->totalFileSize, fl->fileCount, fl->inFtw, fl->isDir, - rpmGlobalMacroContext, fileSystem, internalState @*/ + check_fileList, check_fileListLen, rpmGlobalMacroContext, + fileSystem, internalState @*/ { const char *fileURL = diskURL; struct stat statbuf; @@ -1643,7 +1647,7 @@ static int addFile(FileList fl, const char * diskURL, #endif /* S_XXX macro must be consistent with type in find call at check-files script */ - if (S_ISREG(fileMode)) { + if (check_fileList && S_ISREG(fileMode)) { appendStringBuf(check_fileList, diskURL); appendStringBuf(check_fileList, "\n"); check_fileListLen += strlen(diskURL) + 1; @@ -2557,6 +2561,7 @@ static int generateDepends(Spec spec, Package pkg, rpmfi cpioList, int multiLib) } /* Get the script name (and possible args) to run */ +/*@-branchstate@*/ if (dm->argv[0] != NULL) { const char ** av; @@ -2577,6 +2582,7 @@ static int generateDepends(Spec spec, Package pkg, rpmfi cpioList, int multiLib) } av = _free(av); } +/*@=branchstate@*/ if (myargv[0] == NULL) continue; @@ -2742,6 +2748,8 @@ static void printDeps(Header h) * @return -1 if skipped, 0 on OK, 1 on error */ static int checkFiles(StringBuf fileList, int fileListLen) + /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/ + /*@modifies rpmGlobalMacroContext, fileSystem, internalState @*/ { StringBuf readBuf = NULL; const char * s = NULL; @@ -2784,13 +2792,16 @@ static int checkFiles(StringBuf fileList, int fileListLen) } exit: - freeStringBuf(readBuf); + readBuf = freeStringBuf(readBuf); s = _free(s); av = _free(av); return rc; } +/*@-incondefs@*/ int processBinaryFiles(Spec spec, int installSpecialDoc, int test) + /*@globals check_fileList, check_fileListLen @*/ + /*@modifies check_fileList, check_fileListLen @*/ { Package pkg; int res = 0; @@ -2835,7 +2846,8 @@ int processBinaryFiles(Spec spec, int installSpecialDoc, int test) res = 1; } - freeStringBuf(check_fileList); + check_fileList = freeStringBuf(check_fileList); return res; } +/*@=incondefs@*/ diff --git a/lib/poptQV.c b/lib/poptQV.c index ffaef7ea4..0df54e47f 100644 --- a/lib/poptQV.c +++ b/lib/poptQV.c @@ -128,12 +128,12 @@ struct poptOption rpmQVSourcePoptTable[] = { /* ========== Query specific popt args */ -static void queryArgCallback(/*@unused@*/poptContext con, +static void queryArgCallback(poptContext con, /*@unused@*/enum poptCallbackReason reason, const struct poptOption * opt, const char * arg, /*@unused@*/ const void * data) /*@globals rpmQVKArgs @*/ - /*@modifies rpmQVKArgs @*/ + /*@modifies con, rpmQVKArgs @*/ { QVA_t qva = &rpmQVKArgs; diff --git a/lib/rpmds.c b/lib/rpmds.c index efcc92f07..97c50df0e 100644 --- a/lib/rpmds.c +++ b/lib/rpmds.c @@ -23,7 +23,9 @@ int _rpmds_debug = 0; int _rpmds_nopromote = 1; /*@unchecked@*/ +/*@-exportheadervar@*/ int _rpmds_unspecified_epoch_noise = 0; +/*@=exportheadervar@*/ rpmds XrpmdsUnlink(rpmds ds, const char * msg, const char * fn, unsigned ln) { @@ -452,7 +454,7 @@ int rpmdsNoPromote(const rpmds ds) return nopromote; } -int rpmdsSetNoPromote(const rpmds ds, int nopromote) +int rpmdsSetNoPromote(rpmds ds, int nopromote) { int onopromote = 0; diff --git a/lib/rpmds.h b/lib/rpmds.h index bffc6f2be..ee46e072e 100644 --- a/lib/rpmds.h +++ b/lib/rpmds.h @@ -234,8 +234,8 @@ int rpmdsNoPromote(/*@null@*/ const rpmds ds) * @param ds dependency set * @return previous "Don't promote Epoch:" flag */ -int rpmdsSetNoPromote(/*@null@*/ const rpmds ds, int nopromote) - /*@*/; +int rpmdsSetNoPromote(/*@null@*/ rpmds ds, int nopromote) + /*@modifies ds @*/; /** * Notify of results of dependency match. diff --git a/lib/verify.c b/lib/verify.c index d9689ae32..9e50da4e4 100644 --- a/lib/verify.c +++ b/lib/verify.c @@ -436,10 +436,13 @@ int showVerifyPackage(QVA_t qva, rpmts ts, Header h) if (qva->qva_flags & VERIFY_DEPS) { int save_noise = _rpmds_unspecified_epoch_noise; - _rpmds_unspecified_epoch_noise = 1; +/*@-mods@*/ + if (rpmIsVerbose()) + _rpmds_unspecified_epoch_noise = 1; if ((rc = verifyDependencies(qva, ts, h)) != 0) ec = rc; _rpmds_unspecified_epoch_noise = save_noise; +/*@=mods@*/ } if (qva->qva_flags & VERIFY_FILES) { if ((rc = verifyHeader(qva, ts, fi)) != 0) diff --git a/rpmdb/db3.c b/rpmdb/db3.c index a50051359..bbd18969e 100644 --- a/rpmdb/db3.c +++ b/rpmdb/db3.c @@ -185,7 +185,7 @@ static int db_fini(dbiIndex dbi, const char * dbhome, rpmMessage(RPMMESS_DEBUG, _("closed db environment %s/%s\n"), dbhome, dbfile); - if (rpmdb->db_remove_env || dbi->dbi_tear_down) { + if (rpmdb->db_remove_env) { int xx; /*@-moduncon@*/ /* FIX: annotate db3 methods */ diff --git a/rpmdb/dbconfig.c b/rpmdb/dbconfig.c index 0d8781d23..ede58d826 100644 --- a/rpmdb/dbconfig.c +++ b/rpmdb/dbconfig.c @@ -25,6 +25,9 @@ struct _dbiIndex db3dbi; /*@unchecked@*/ static int dbi_use_cursors; +/*@unchecked@*/ +static int dbi_tear_down; + /*@-compmempass -immediatetrans -exportlocal -exportheadervar@*/ /** \ingroup db3 */ @@ -128,7 +131,7 @@ struct poptOption rdbOptions[] = { { "verify", 0,POPT_ARG_NONE, &db3dbi.dbi_verify_on_close, 0, NULL, NULL }, - { "teardown", 0,POPT_ARG_NONE, &db3dbi.dbi_tear_down, 0, + { "teardown", 0,POPT_ARG_NONE, &dbi_tear_down, 0, NULL, NULL }, { "usecursors",0,POPT_ARG_NONE, &dbi_use_cursors, 0, NULL, NULL }, @@ -429,9 +432,8 @@ dbiIndex db3New(rpmdb rpmdb, rpmTag rpmtag) if (!dbi->dbi_use_dbenv) { /* db3 dbenv is always used now. */ dbi->dbi_use_dbenv = 1; dbi->dbi_eflags |= (DB_INIT_MPOOL|DB_JOINENV); - dbi->dbi_mp_mmapsize = 8 * 1024 * 1024; - dbi->dbi_mp_size = 512 * 1024; - dbi->dbi_tear_down = 1; + dbi->dbi_mp_mmapsize = 16 * 1024 * 1024; + dbi->dbi_mp_size = 1 * 1024 * 1024; } if ((dbi->dbi_bt_flags | dbi->dbi_h_flags) & DB_DUP) diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index 7e433e47e..33d8f4e8a 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -632,13 +632,13 @@ dbiIndexSet dbiFreeIndexSet(dbiIndexSet set) { static sigset_t caught; /* forward ref */ -static void handler(int signum) - /*@globals caught @*/ - /*@modifies caught @*/; +static void handler(int signum); /** */ -struct sigtbl_s { +/*@unchecked@*/ +/*@-fullinitblock@*/ +static struct sigtbl_s { int signum; int active; struct sigaction act; @@ -650,11 +650,14 @@ struct sigtbl_s { { SIGQUIT, 0, { {handler} } }, { -1, 0, { {NULL} } }, }; +/*@=fullinitblock@*/ /** */ +/*@-incondefs@*/ static void handler(int signum) - /*@*/ + /*@globals caught, satbl @*/ + /*@modifies caught @*/ { struct sigtbl_s * tbl; @@ -663,17 +666,18 @@ static void handler(int signum) continue; if (!tbl->active) continue; - sigaddset(&caught, signum); + (void) sigaddset(&caught, signum); break; } } +/*@=incondefs@*/ /** * Enable all signal handlers */ static int enableSignals(void) /*@globals caught, satbl, fileSystem @*/ - /*@modifies *oldMask, caught, satbl, fileSystem @*/ + /*@modifies caught, satbl, fileSystem @*/ { struct sigtbl_s * tbl; sigset_t newMask, oldMask; @@ -685,22 +689,23 @@ static int enableSignals(void) for(tbl = satbl; tbl->signum >= 0; tbl++) { if (tbl->active++ > 0) continue; - sigdelset(&caught, tbl->signum); + (void) sigdelset(&caught, tbl->signum); rc = sigaction(tbl->signum, &tbl->act, &tbl->oact); if (rc) break; } return sigprocmask(SIG_SETMASK, &oldMask, NULL); } -rpmdb dbrock; +/*@unchecked@*/ +static rpmdb dbrock; /** * Check for signals. */ /*@mayexit@*/ static int checkSignals(void) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/ + /*@globals dbrock, satbl, fileSystem @*/ + /*@modifies dbrock, fileSystem @*/ { struct sigtbl_s * tbl; sigset_t newMask, oldMask; @@ -718,11 +723,13 @@ static int checkSignals(void) if (terminate) { rpmdb db; rpmMessage(RPMMESS_WARNING, "Exiting on signal ...\n"); +/*@-newreftrans@*/ while ((db = dbrock) != NULL) { - dbrock = db->db_next; +/*@i@*/ dbrock = db->db_next; db->db_next = NULL; (void) rpmdbClose(db); } +/*@=newreftrans@*/ exit(EXIT_FAILURE); } return sigprocmask(SIG_SETMASK, &oldMask, NULL); @@ -732,8 +739,8 @@ static int checkSignals(void) * Disable all signal handlers */ static int disableSignals(void) - /*@globals caught, fileSystem @*/ - /*@modifies db, caught, fileSystem @*/ + /*@globals satbl, fileSystem @*/ + /*@modifies satbl, fileSystem @*/ { struct sigtbl_s * tbl; sigset_t newMask, oldMask; @@ -755,9 +762,9 @@ static int disableSignals(void) /** * Block all signals, returning previous signal mask. */ -static int blockSignals(rpmdb db, /*@out@*/ sigset_t * oldMask) - /*@globals caught, satbl, fileSystem @*/ - /*@modifies *oldMask, caught, satbl, fileSystem @*/ +static int blockSignals(/*@unused@*/ rpmdb db, /*@out@*/ sigset_t * oldMask) + /*@globals satbl, fileSystem @*/ + /*@modifies *oldMask, satbl, fileSystem @*/ { struct sigtbl_s * tbl; sigset_t newMask; @@ -776,11 +783,11 @@ static int blockSignals(rpmdb db, /*@out@*/ sigset_t * oldMask) * Restore signal mask. */ /*@mayexit@*/ -static int unblockSignals(rpmdb db, sigset_t * oldMask) - /*@globals caught, fileSystem @*/ - /*@modifies db, caught, fileSystem @*/ +static int unblockSignals(/*@unused@*/ rpmdb db, sigset_t * oldMask) + /*@globals dbrock, fileSystem @*/ + /*@modifies dbrock, fileSystem @*/ { - checkSignals(); + (void) checkSignals(); return sigprocmask(SIG_SETMASK, oldMask, NULL); } @@ -844,7 +851,10 @@ int rpmdbCloseDBI(rpmdb db, int rpmtag) } /* XXX query.c, rpminstall.c, verify.c */ +/*@-incondefs@*/ int rpmdbClose(rpmdb db) + /*@globals dbrock @*/ + /*@modifies dbrock @*/ { rpmdb * prev, next; int dbix; @@ -876,13 +886,15 @@ int rpmdbClose(rpmdb db) db->db_bits = PBM_FREE(db->db_bits); db->_dbi = _free(db->_dbi); +/*@-newreftrans@*/ prev = &dbrock; while ((next = *prev) != NULL && next != db) prev = &next->db_next; if (next) { - *prev = next->db_next; +/*@i@*/ *prev = next->db_next; next->db_next = NULL; } +/*@=newreftrans@*/ /*@-refcounttrans@*/ db = _free(db); /*@=refcounttrans@*/ /*@=usereleased@*/ @@ -891,6 +903,7 @@ exit: (void) disableSignals(); return rc; } +/*@=incondefs@*/ int rpmdbSync(rpmdb db) { @@ -966,9 +979,9 @@ static int openDatabase(/*@null@*/ const char * prefix, /*@null@*/ const char * dbpath, int _dbapi, /*@null@*/ /*@out@*/ rpmdb *dbp, int mode, int perms, int flags) - /*@globals rpmGlobalMacroContext, - fileSystem @*/ - /*@modifies *dbp, fileSystem @*/ + /*@globals dbrock, rpmGlobalMacroContext, + fileSystem, internalState @*/ + /*@modifies dbrock, *dbp, fileSystem, internalState @*/ /*@requires maxSet(dbp) >= 0 @*/ { rpmdb db; @@ -1088,9 +1101,11 @@ exit: if (rc || justCheck || dbp == NULL) xx = rpmdbClose(db); else { - db->db_next = dbrock; +/*@-assignexpose -newreftrans@*/ +/*@i@*/ db->db_next = dbrock; dbrock = db; - *dbp = db; +/*@i@*/ *dbp = db; +/*@=assignexpose =newreftrans@*/ } return rc; @@ -1741,7 +1756,7 @@ rpmdbMatchIterator rpmdbFreeIterator(rpmdbMatchIterator mi) mi->mi_db = rpmdbUnlink(mi->mi_db, "matchIterator"); mi = _free(mi); - checkSignals(); + (void) checkSignals(); return mi; } @@ -2470,7 +2485,7 @@ rpmdbMatchIterator rpmdbInitIterator(rpmdb db, rpmTag rpmtag, if (db == NULL) return NULL; - checkSignals(); + (void) checkSignals(); /* XXX HACK to remove rpmdbFindByLabel/findMatches from the API */ if (rpmtag == RPMDBI_LABEL) { diff --git a/rpmdb/rpmdb.h b/rpmdb/rpmdb.h index 875f1d669..ea2a85c83 100644 --- a/rpmdb/rpmdb.h +++ b/rpmdb/rpmdb.h @@ -294,7 +294,6 @@ struct _dbiIndex { int dbi_api; /*!< Berkeley API type */ int dbi_verify_on_close; - int dbi_tear_down; /*!< tear down dbenv on close */ int dbi_use_dbenv; /*!< use db environment? */ int dbi_permit_dups; /*!< permit duplicate entries? */ int dbi_no_fsync; /*!< no-op fsync for db */ @@ -840,8 +839,8 @@ rpmdb XrpmdbLink (rpmdb db, const char * msg, */ int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp, int mode, int perms) - /*@globals fileSystem @*/ - /*@modifies *dbp, fileSystem @*/; + /*@globals fileSystem, internalState @*/ + /*@modifies *dbp, fileSystem, internalState @*/; /** \ingroup rpmdb * Initialize database. @@ -850,8 +849,8 @@ int rpmdbOpen (/*@null@*/ const char * prefix, /*@null@*/ /*@out@*/ rpmdb * dbp, * @return 0 on success */ int rpmdbInit(/*@null@*/ const char * prefix, int perms) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/; + /*@globals fileSystem, internalState @*/ + /*@modifies fileSystem, internalState @*/; /** \ingroup rpmdb * Verify database components. @@ -859,8 +858,8 @@ int rpmdbInit(/*@null@*/ const char * prefix, int perms) * @return 0 on success */ int rpmdbVerify(/*@null@*/ const char * prefix) - /*@globals fileSystem @*/ - /*@modifies fileSystem @*/; + /*@globals fileSystem, internalState @*/ + /*@modifies fileSystem, internalState @*/; /** * Close a single database index. diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index 5b7108d0e..c5b4681bd 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -377,8 +377,8 @@ int pgpPrtSubType(const byte *h, unsigned int hlen, pgpSigType sigtype) /*@switchbreak@*/ break; case PGPSUBTYPE_SIG_CREATE_TIME: /*@-mods -mayaliasunique @*/ - if (sigtype == PGPSIGTYPE_POSITIVE_CERT && - _digp && !(_digp->saved & PGPDIG_SAVED_TIME)) + if (_digp && !(_digp->saved & PGPDIG_SAVED_TIME) && + sigtype == PGPSIGTYPE_POSITIVE_CERT) { _digp->saved |= PGPDIG_SAVED_TIME; memcpy(_digp->time, p+1, sizeof(_digp->time)); @@ -397,8 +397,8 @@ int pgpPrtSubType(const byte *h, unsigned int hlen, pgpSigType sigtype) case PGPSUBTYPE_ISSUER_KEYID: /* issuer key ID */ /*@-mods -mayaliasunique @*/ - if (sigtype == PGPSIGTYPE_POSITIVE_CERT && - _digp && !(_digp->saved & PGPDIG_SAVED_ID)) + if (_digp && !(_digp->saved & PGPDIG_SAVED_ID) && + sigtype == PGPSIGTYPE_POSITIVE_CERT) { _digp->saved |= PGPDIG_SAVED_ID; memcpy(_digp->signid, p+1, sizeof(_digp->signid)); @@ -747,9 +747,9 @@ ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE; /* RPMTRANS_FLAG_KEEPOBSOLETE */ if (!ia->incldocs) { - if (ia->transFlags & RPMTRANS_FLAG_NODOCS) + if (ia->transFlags & RPMTRANS_FLAG_NODOCS) { ; - else if (rpmExpandNumeric("%{_excludedocs}")) + } else if (rpmExpandNumeric("%{_excludedocs}")) ia->transFlags |= RPMTRANS_FLAG_NODOCS; } |