diff options
author | jbj <devnull@localhost> | 2005-01-04 17:11:00 +0000 |
---|---|---|
committer | jbj <devnull@localhost> | 2005-01-04 17:11:00 +0000 |
commit | 228d0e350ac2f20ee7ca1f74c46620e219559542 (patch) | |
tree | f4fb9f7fff14e3c3034db9ec833defcc834ffa82 | |
parent | 34caf4357ac173eb273ec16611dc8da24fa75858 (diff) | |
download | rpm-228d0e350ac2f20ee7ca1f74c46620e219559542.tar.gz rpm-228d0e350ac2f20ee7ca1f74c46620e219559542.tar.bz2 rpm-228d0e350ac2f20ee7ca1f74c46620e219559542.zip |
Splint fiddles.
CVS patchset: 7669
CVS date: 2005/01/04 17:11:00
-rw-r--r-- | .splintrc | 2 | ||||
-rw-r--r-- | CHANGES | 3 | ||||
-rw-r--r-- | build/files.c | 4 | ||||
-rw-r--r-- | build/rpmfc.c | 1 | ||||
-rw-r--r-- | lib/formats.c | 4 | ||||
-rw-r--r-- | lib/psm.c | 2 | ||||
-rw-r--r-- | lib/rpmal.c | 7 | ||||
-rw-r--r-- | lib/rpmcli.h | 2 | ||||
-rw-r--r-- | lib/rpmfi.c | 2 | ||||
-rw-r--r-- | lib/rpmts.c | 8 | ||||
-rw-r--r-- | lib/rpmts.h | 2 | ||||
-rw-r--r-- | lib/signature.c | 2 | ||||
-rw-r--r-- | rpmdb/rpmdb.c | 2 | ||||
-rw-r--r-- | rpmio/rpmdav.c | 12 | ||||
-rw-r--r-- | rpmio/rpmpgp.c | 20 |
15 files changed, 50 insertions, 23 deletions
@@ -1,4 +1,4 @@ --I. -I./build -I./lib -I./rpmdb -I./rpmio -I./beecrypt -I./lua/include -I./lua/local -I./file -I./popt -I./elfutils/libelf -I./zlib -I/usr/lib/gcc-lib/i386-redhat-linux/3.1/include -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DHAVE_DEV_DSP -DHAVE_SYS_SOUNDCARD +-I. -I./build -I./lib -I./rpmdb -I./rpmio -I./beecrypt -I./lua/include -I./lua/local -I./file/src -I./popt -I./elfutils/libelf -I./zlib -I/usr/lib/gcc-lib/i386-redhat-linux/3.1/include -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DHAVE_DEV_DSP -DHAVE_SYS_SOUNDCARD #+partial +forcehints @@ -31,7 +31,6 @@ - permit Obsoletes: /path/to/file. - permit Conflicts: /path/to/file. - free rpmrc when looping on --target arches (#127730). - - port to internal file-4.10 libmagic rather than libfmagic. - fix: handle non-unique dirnames in rpmalAdd(). - integrate rpmgi "generic iterator" with query/verify. - bump popt version to 1.10. @@ -49,6 +48,7 @@ - python: bleeping keywords broke labelCompare. - add support for automagic pubkey retrieval using HKP. - detect and return errors from neon through Ferror. + - use package color as Obsoletes: color. 4.3.2 -> 4.3.3: - bump micro version. @@ -57,6 +57,7 @@ - selinux: use rpm_execcon, not execv, to run scriptlets (#136848). - fix: segfault on --verifydb (#138589). - sparcv8: optflags changed to -mtune=ultrasparc (#140420). + - port to internal file-4.10 libmagic rather than libfmagic. 4.3.1 -> 4.3.2: - use /etc/selinux/targeted/contexts/files/file_contexts for now. diff --git a/build/files.c b/build/files.c index cd3c01366..43eb8debe 100644 --- a/build/files.c +++ b/build/files.c @@ -1699,7 +1699,7 @@ static int recurseDir(FileList fl, const char * diskURL) char * ftsSet[2]; FTS * ftsp; FTSENT * fts; - int ftsOpts = (FTS_COMFOLLOW | FTS_NOCHDIR | FTS_PHYSICAL); + int myFtsOpts = (FTS_COMFOLLOW | FTS_NOCHDIR | FTS_PHYSICAL); int rc = RPMERR_BADSPEC; fl->inFtw = 1; /* Flag to indicate file has buildRootURL prefixed */ @@ -1707,7 +1707,7 @@ static int recurseDir(FileList fl, const char * diskURL) ftsSet[0] = (char *) diskURL; ftsSet[1] = NULL; - ftsp = Fts_open(ftsSet, ftsOpts, NULL); + ftsp = Fts_open(ftsSet, myFtsOpts, NULL); while ((fts = Fts_read(ftsp)) != NULL) { switch (fts->fts_info) { case FTS_D: /* preorder directory */ diff --git a/build/rpmfc.c b/build/rpmfc.c index ae6b31c81..48b5fe698 100644 --- a/build/rpmfc.c +++ b/build/rpmfc.c @@ -1171,6 +1171,7 @@ int rpmfcClassify(rpmfc fc, ARGV_t argv) size_t slen; int fcolor; int xx; +/*@observer@*/ static const char * magicfile = "/usr/lib/rpm/magic"; int msflags = MAGIC_CHECK; /* XXX MAGIC_COMPRESS flag? */ magic_t ms = NULL; diff --git a/lib/formats.c b/lib/formats.c index ebfc1db24..dd0272209 100644 --- a/lib/formats.c +++ b/lib/formats.c @@ -451,7 +451,7 @@ static /*@only@*/ char * pgpsigFormat(int_32 type, const void * data, t = stpcpy(t, "RSA"); break; default: - snprintf(t, nb - (t - val), "%d", sigp->pubkey_algo); + (void) snprintf(t, nb - (t - val), "%d", sigp->pubkey_algo); t += strlen(t); break; } @@ -466,7 +466,7 @@ static /*@only@*/ char * pgpsigFormat(int_32 type, const void * data, t = stpcpy(t, "SHA1"); break; default: - snprintf(t, nb - (t - val), "%d", sigp->hash_algo); + (void) snprintf(t, nb - (t - val), "%d", sigp->hash_algo); t += strlen(t); break; } @@ -885,7 +885,9 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln, /* Permit libselinux to do the scriptlet exec. */ if (rpmtsSELinuxEnabled(ts) == 1) { +/*@-moduncon@*/ xx = rpm_execcon(0, argv[0], argv, environ); +/*@=moduncon@*/ if (xx != 0) break; } diff --git a/lib/rpmal.c b/lib/rpmal.c index f7272183e..2527bcbec 100644 --- a/lib/rpmal.c +++ b/lib/rpmal.c @@ -78,7 +78,7 @@ typedef /*@abstract@*/ struct fileIndexEntry_s * fileIndexEntry; * A file to be installed/removed. */ struct fileIndexEntry_s { -/*@dependent@*/ /*@null@*/ +/*@dependent@*/ /*@relnull@*/ const char * baseName; /*!< File basename. */ int baseNameLen; alNum pkgNum; /*!< Containing package index. */ @@ -92,7 +92,7 @@ typedef /*@abstract@*/ struct dirInfo_s * dirInfo; * A directory to be installed/removed. */ struct dirInfo_s { -/*@owned@*/ /*@null@*/ +/*@owned@*/ /*@relnull@*/ const char * dirName; /*!< Directory path (+ trailing '/'). */ int dirNameLen; /*!< No. bytes in directory path. */ /*@owned@*/ @@ -482,11 +482,12 @@ fprintf(stderr, "*** add %p[%d] 0x%x\n", al->list, pkgNum, tscolor); for (dx = 0; dx < dc; dx++) { (void) rpmfiSetDX(fi, dx); DN = rpmfiDN(fi); + if (DN != NULL) for (i = 0; i < dx; i++) { const char * iDN; (void) rpmfiSetDX(fi, i); iDN = rpmfiDN(fi); - if (!strcmp(DN, iDN)) + if (iDN != NULL && !strcmp(DN, iDN)) /*@innerbreak@*/ break; } dirUnique[dx] = i; diff --git a/lib/rpmcli.h b/lib/rpmcli.h index 6e2c89487..c24f518de 100644 --- a/lib/rpmcli.h +++ b/lib/rpmcli.h @@ -267,7 +267,7 @@ struct rpmQVKArguments_s { rpmfileAttrs qva_fflags; /*!< Bit(s) to filter on attribute. */ /*@only@*/ /*@null@*/ rpmdbMatchIterator qva_mi; /*!< Match iterator on selected headers. */ -/*@refccounted@*/ /*@null@*/ +/*@refccounted@*/ /*@relnull@*/ rpmgi qva_gi; /*!< Generalized iterator on args. */ rpmRC qva_rc; /*!< Current return code. */ diff --git a/lib/rpmfi.c b/lib/rpmfi.c index 12d01cbd7..4767206a5 100644 --- a/lib/rpmfi.c +++ b/lib/rpmfi.c @@ -590,6 +590,7 @@ fileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing) * This order matters - we'd prefer to CREATE the file if at all * possible in case something else (like the timestamp) has changed. */ + memset(buffer, 0, sizeof(buffer)); if (dbWhat == REG) { const unsigned char * omd5, * nmd5; /* XXX avoid md5 on sparse /var/log/lastlog file. */ @@ -606,7 +607,6 @@ fileAction rpmfiDecideFate(const rpmfi ofi, rpmfi nfi, int skipMissing) /*@=nullpass@*/ } else /* dbWhat == LINK */ { const char * oFLink, * nFLink; - memset(buffer, 0, sizeof(buffer)); if (readlink(fn, buffer, sizeof(buffer) - 1) == -1) return FA_CREATE; /* assume file has been removed */ oFLink = rpmfiFLink(ofi); diff --git a/lib/rpmts.c b/lib/rpmts.c index 4af556950..288642058 100644 --- a/lib/rpmts.c +++ b/lib/rpmts.c @@ -391,6 +391,7 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p } mi = rpmdbFreeIterator(mi); +/*@-branchstate@*/ if (ix >= 0) { char hnum[32]; sprintf(hnum, "h#%d", hx); @@ -399,6 +400,7 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p ts->pkpkt = _free(ts->pkpkt); ts->pkpktlen = 0; } +/*@=branchstate@*/ } /* Try keyserver lookup. */ @@ -411,6 +413,7 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p xx = (pgpReadPkts(fn,&ts->pkpkt,&ts->pkpktlen) != PGPARMOR_PUBKEY); } fn = _free(fn); +/*@-branchstate@*/ if (xx) { ts->pkpkt = _free(ts->pkpkt); ts->pkpktlen = 0; @@ -418,6 +421,7 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p /* Save new pubkey in local ts keyring for delayed import. */ pubkeysource = xstrdup("keyserver"); } +/*@=branchstate@*/ } #ifdef NOTNOW @@ -439,7 +443,7 @@ fprintf(stderr, "*** free pkt %p[%d] id %08x %08x\n", ts->pkpkt, ts->pkpktlen, p #endif /* Was a matching pubkey found? */ - if (ts->pkpkt == NULL || ts->pkpktlen <= 0) + if (ts->pkpkt == NULL || ts->pkpktlen == 0) goto exit; /* Retrieve parameters from pubkey packet(s). */ @@ -965,6 +969,7 @@ const char * rpmtsRootDir(rpmts ts) { const char * rootDir = NULL; +/*@-branchstate@*/ if (ts != NULL && ts->rootDir != NULL) { urltype ut = urlPath(ts->rootDir, &rootDir); switch (ut) { @@ -981,6 +986,7 @@ const char * rpmtsRootDir(rpmts ts) break; } } +/*@=branchstate@*/ return rootDir; } diff --git a/lib/rpmts.h b/lib/rpmts.h index 64ec13641..cd924bdd7 100644 --- a/lib/rpmts.h +++ b/lib/rpmts.h @@ -498,9 +498,11 @@ rpmdbMatchIterator rpmtsInitIterator(const rpmts ts, rpmTag rpmtag, * @param ts rpm transaction * @return RPMRC_OK on success, RPMRC_NOKEY if not found */ +/*@-exportlocal@*/ rpmRC rpmtsFindPubkey(rpmts ts) /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState */; +/*@=exportlocal@*/ /** \ingroup rpmts * Close the database used by the transaction to solve dependencies. diff --git a/lib/signature.c b/lib/signature.c index 82d91edbb..f30eb7e2d 100644 --- a/lib/signature.c +++ b/lib/signature.c @@ -129,7 +129,9 @@ static inline rpmRC printSize(FD_t fd, int siglen, int pad, int datalen) /* HACK: workaround for davRead wiring. */ if (fdno == 123456789) { st.st_size = 0; +/*@-sizeoftype@*/ st.st_size -= sizeof(struct rpmlead)+siglen+pad+datalen; +/*@=sizeoftype@*/ } else if (fstat(fdno, &st) < 0) return RPMRC_FAIL; diff --git a/rpmdb/rpmdb.c b/rpmdb/rpmdb.c index a6b550954..e54cae0c0 100644 --- a/rpmdb/rpmdb.c +++ b/rpmdb/rpmdb.c @@ -699,7 +699,9 @@ int rpmdbCheckSignals(void) rpmdb db; rpmdbMatchIterator mi; +/*@-abstract@*/ /* sigset_t is abstract type */ rpmMessage(RPMMESS_DEBUG, "Exiting on signal(0x%lx) ...\n", *((unsigned long *)&rpmsqCaught)); +/*@=abstract@*/ /*@-branchstate@*/ while ((mi = rpmmiRock) != NULL) { diff --git a/rpmio/rpmdav.c b/rpmio/rpmdav.c index f5927237c..59e8ae1f4 100644 --- a/rpmio/rpmdav.c +++ b/rpmio/rpmdav.c @@ -588,10 +588,12 @@ fprintf(stderr, "==> %s skipping target resource.\n", path); checkout = ne_propset_value(set, &fetch_props[5]); /*@=boundsread@*/ +/*@-branchstate@*/ if (clength == NULL) status = ne_propset_status(set, &fetch_props[0]); if (modtime == NULL) status = ne_propset_status(set, &fetch_props[1]); +/*@=branchstate@*/ if (newres->type == resr_normal && status != NULL) { /* It's an error! */ @@ -1532,12 +1534,14 @@ DIR * davOpendir(const char * path) /* HACK: glob does not pass dirs with trailing '/' */ nb = strlen(path)+1; +/*@-branchstate@*/ if (path[nb-1] != '/') { - char * t = alloca(nb+1); - *t = '\0'; - (void) stpcpy( stpcpy(t, path), "/"); - path = t; + char * npath = alloca(nb+1); + *npath = '\0'; + (void) stpcpy( stpcpy(npath, path), "/"); + path = npath; } +/*@=branchstate@*/ if (_dav_debug < 0) fprintf(stderr, "*** davOpendir(%s)\n", path); diff --git a/rpmio/rpmpgp.c b/rpmio/rpmpgp.c index c631ad89b..b5e46640d 100644 --- a/rpmio/rpmpgp.c +++ b/rpmio/rpmpgp.c @@ -938,7 +938,7 @@ int pgpPrtComment(pgpTag tag, const byte *h, unsigned int hlen) return 0; } -int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, +int pgpPubkeyFingerprint(const byte * pkt, /*@unused@*/ unsigned int pktlen, byte * keyid) { const byte *s = pkt; @@ -958,11 +958,13 @@ int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, switch (v->pubkey_algo) { case PGPPUBKEYALGO_RSA: s += (pgpMpiLen(s) - 8); - memcpy(keyid, s, 8); +/*@-boundswrite@*/ + memmove(keyid, s, 8); +/*@=boundswrite@*/ rc = 0; - break; + /*@innerbreak@*/ break; default: /* TODO: md5 of mpi bodies (i.e. no length) */ - break; + /*@innerbreak@*/ break; } } break; case 4: @@ -975,11 +977,11 @@ int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, case PGPPUBKEYALGO_RSA: for (i = 0; i < 2; i++) s += pgpMpiLen(s); - break; + /*@innerbreak@*/ break; case PGPPUBKEYALGO_DSA: for (i = 0; i < 4; i++) s += pgpMpiLen(s); - break; + /*@innerbreak@*/ break; } ctx = rpmDigestInit(PGPHASHALGO_SHA1, RPMDIGEST_NONE); @@ -987,7 +989,9 @@ int pgpPubkeyFingerprint(const byte * pkt, unsigned int pktlen, (void) rpmDigestFinal(ctx, (void **)&SHA1, NULL, 0); s = SHA1 + 12; - memcpy(keyid, s, 8); +/*@-boundswrite@*/ + memmove(keyid, s, 8); +/*@=boundswrite@*/ rc = 0; if (SHA1) free(SHA1); @@ -1031,10 +1035,12 @@ int pgpPrtPkt(const byte *pkt, unsigned int pleft) case PGPTAG_PUBLIC_KEY: /* Get the public key fingerprint. */ if (_digp) { +/*@-mods@*/ if (!pgpPubkeyFingerprint(pkt, pktlen, _digp->signid)) _digp->saved |= PGPDIG_SAVED_ID; else memset(_digp->signid, 0, sizeof(_digp->signid)); +/*@=mods@*/ } /*@fallthrough@*/ case PGPTAG_PUBLIC_SUBKEY: |