summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2003-01-23 20:23:24 +0000
committerjbj <devnull@localhost>2003-01-23 20:23:24 +0000
commit7e716b70fb68cbef5bd35e154a734269067f1e37 (patch)
tree3e9d8030e9e884673e9f561618b4711ff95cd912 /lib
parentff140452c3620c5216778aa72505ada37f3407be (diff)
downloadrpm-7e716b70fb68cbef5bd35e154a734269067f1e37.tar.gz
rpm-7e716b70fb68cbef5bd35e154a734269067f1e37.tar.bz2
rpm-7e716b70fb68cbef5bd35e154a734269067f1e37.zip
splint fiddles.
CVS patchset: 6023 CVS date: 2003/01/23 20:23:24
Diffstat (limited to 'lib')
-rw-r--r--lib/.splintrc1
-rw-r--r--lib/fs.c10
-rw-r--r--lib/fsm.c71
-rw-r--r--lib/fsm.h4
-rw-r--r--lib/manifest.c6
-rw-r--r--lib/misc.c5
-rw-r--r--lib/package.c1
-rw-r--r--lib/psm.c48
-rw-r--r--lib/query.c8
-rw-r--r--lib/rpmchecksig.c1
-rw-r--r--lib/rpminstall.c38
-rw-r--r--lib/rpmrc.c56
-rw-r--r--lib/rpmte.c3
-rw-r--r--lib/rpmts.c8
-rw-r--r--lib/signature.c4
-rw-r--r--lib/transaction.c4
-rw-r--r--lib/verify.c4
17 files changed, 115 insertions, 157 deletions
diff --git a/lib/.splintrc b/lib/.splintrc
index d3df363f0..f84dc6e6c 100644
--- a/lib/.splintrc
+++ b/lib/.splintrc
@@ -8,6 +8,7 @@
+unixlib
++access-slovak
-unrecogcomments # XXX ignore doxygen markings
+strict # lclint level
diff --git a/lib/fs.c b/lib/fs.c
index 4fc24f0a8..73ee6d6fa 100644
--- a/lib/fs.c
+++ b/lib/fs.c
@@ -1,4 +1,3 @@
-/*@-mods@*/
/**
* \file lib/fs.c
*/
@@ -24,6 +23,8 @@ struct fsinfo {
static int numFilesystems = 0;
void freeFilesystems(void)
+ /*@globals filesystems, fsnames, numFilesystems @*/
+ /*@modifies filesystems, fsnames, numFilesystems @*/
{
int i;
@@ -133,8 +134,10 @@ static int getFilesystemList(void)
* @return 0 on success, 1 on error
*/
static int getFilesystemList(void)
- /*@globals fileSystem, internalState@*/
- /*@modifies fileSystem, internalState@*/
+ /*@globals filesystems, fsnames, numFilesystems,
+ fileSystem, internalState @*/
+ /*@modifies filesystems, fsnames, numFilesystems,
+ fileSystem, internalState @*/
{
int numAlloced = 10;
struct stat sb;
@@ -353,4 +356,3 @@ int rpmGetFilesystemUsage(const char ** fileList, int_32 * fssizes, int numFiles
return 0;
}
/*@=usereleased =onlytrans@*/
-/*@=mods@*/
diff --git a/lib/fsm.c b/lib/fsm.c
index 7f777d22b..af6f2272a 100644
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -19,13 +19,11 @@
#include "debug.h"
-/*@access FD_t @*/
+/*@access FD_t @*/ /* XXX void ptr args */
/*@access FSMI_t @*/
/*@access FSM_t @*/
/*@access rpmfi @*/
-/*@access rpmte @*/
-/*@access rpmts @*/
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
@@ -390,8 +388,8 @@ static int saveHardLink(/*@special@*/ /*@partial@*/ FSM_t fsm)
/*@uses fsm->links, fsm->ix, fsm->sb, fsm->goal, fsm->nsuffix @*/
/*@defines fsm->li @*/
/*@releases fsm->path @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies errno, fsm, fileSystem, internalState @*/
{
struct stat * st = &fsm->sb;
int rc = 0;
@@ -523,10 +521,8 @@ int fsmSetup(FSM_t fsm, fileStage goal,
int rc, ec = 0;
fsm->goal = goal;
- if (cfd) {
- /*@-type@*/ /* FIX: cast? */
+ if (cfd != NULL) {
fsm->cfd = fdLink(cfd, "persist (fsm)");
- /*@=type@*/
pos = fdGetCpioPos(fsm->cfd);
fdSetCpioPos(fsm->cfd, 0);
}
@@ -579,10 +575,8 @@ int fsmTeardown(FSM_t fsm)
rc = fsmStage(fsm, FSM_DESTROY);
fsm->iter = mapFreeIterator(fsm->iter);
- if (fsm->cfd) {
- /*@-type@*/ /* FIX: cast? */
+ if (fsm->cfd != NULL) {
fsm->cfd = fdFree(fsm->cfd, "persist (fsm)");
- /*@=type@*/
fsm->cfd = NULL;
}
fsm->failedFile = NULL;
@@ -748,8 +742,8 @@ int fsmMapAttrs(FSM_t fsm)
*/
static int expandRegular(/*@special@*/ FSM_t fsm)
/*@uses fsm->sb @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
const struct stat * st = &fsm->sb;
int left = st->st_size;
@@ -815,8 +809,8 @@ exit:
*/
static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
/*@uses fsm->path, fsm->opath, fsm->sb, fsm->osb, fsm->cfd @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
const char * path = fsm->path;
const char * opath = fsm->opath;
@@ -939,7 +933,7 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
rc = 0;
exit:
- if (fsm->rfd)
+ if (fsm->rfd != NULL)
(void) fsmStage(fsm, FSM_RCLOSE);
/*@-dependenttrans@*/
fsm->opath = opath;
@@ -955,8 +949,8 @@ exit:
*/
static int writeLinkedFile(/*@special@*/ FSM_t fsm)
/*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->li, fsm->failedFile @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
const char * path = fsm->path;
const char * nsuffix = fsm->nsuffix;
@@ -1003,8 +997,8 @@ static int writeLinkedFile(/*@special@*/ FSM_t fsm)
/*@-boundsread@*/
static int fsmMakeLinks(/*@special@*/ FSM_t fsm)
/*@uses fsm->path, fsm->opath, fsm->nsuffix, fsm->ix, fsm->li @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
const char * path = fsm->path;
const char * opath = fsm->opath;
@@ -1068,8 +1062,8 @@ static int fsmMakeLinks(/*@special@*/ FSM_t fsm)
static int fsmCommitLinks(/*@special@*/ FSM_t fsm)
/*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->sb,
fsm->li, fsm->links @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
const char * path = fsm->path;
const char * nsuffix = fsm->nsuffix;
@@ -1114,8 +1108,8 @@ static int fsmCommitLinks(/*@special@*/ FSM_t fsm)
*/
static int fsmRmdirs(/*@special@*/ FSM_t fsm)
/*@uses fsm->path, fsm->dnlx, fsm->ldn, fsm->rdbuf, fsm->iter @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
const char * path = fsm->path;
void * dnli = dnlInitIterator(fsm, 1);
@@ -1171,8 +1165,8 @@ static int fsmMkdirs(/*@special@*/ FSM_t fsm)
/*@uses fsm->path, fsm->sb, fsm->osb, fsm->rdbuf, fsm->iter,
fsm->ldn, fsm->ldnlen, fsm->ldnalloc @*/
/*@defines fsm->dnlx, fsm->ldn @*/
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
struct stat * st = &fsm->sb;
struct stat * ost = &fsm->osb;
@@ -1284,6 +1278,8 @@ static int fsmMkdirs(/*@special@*/ FSM_t fsm)
* @return 0 on success
*/
static int fsmStat(FSM_t fsm)
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/
{
int saveerrno = errno;
int rc = 0;
@@ -1507,9 +1503,7 @@ int fsmStage(FSM_t fsm, fileStage stage)
fsm->ix = -1;
fsm->links = NULL;
fsm->li = NULL;
- /*@-mods@*/
errno = 0; /* XXX get rid of EBADF */
- /*@=mods@*/
/* Detect and create directories not explicitly in package. */
if (fsm->goal == FSM_PKGINSTALL) {
@@ -1577,9 +1571,7 @@ int fsmStage(FSM_t fsm, fileStage stage)
rc = fsmStage(fsm, (!(fsm->mapFlags & CPIO_FOLLOW_SYMLINKS)
? FSM_LSTAT : FSM_STAT));
if (rc == CPIOERR_LSTAT_FAILED && errno == ENOENT) {
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
rc = 0;
fsm->exists = 0;
} else if (rc == 0) {
@@ -1771,9 +1763,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
if (fsm->dnlx)
(void) fsmStage(fsm, FSM_RMDIRS);
#endif
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
}
/*@-boundswrite@*/
if (fsm->failedFile && *fsm->failedFile == NULL)
@@ -1973,18 +1963,14 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
rc = fsmStage(fsm, FSM_STAT);
if (rc == CPIOERR_STAT_FAILED && errno == ENOENT) rc = 0;
if (rc) break;
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
if (S_ISDIR(ost->st_mode)) return 0;
}
} else if (S_ISLNK(st->st_mode)) {
if (S_ISLNK(ost->st_mode)) {
/* XXX NUL terminated result in fsm->rdbuf, len in fsm->rdnb. */
rc = fsmStage(fsm, FSM_READLINK);
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
if (rc) break;
if (!strcmp(fsm->opath, fsm->rdbuf)) return 0;
}
@@ -2224,11 +2210,12 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
case FSM_ROPEN:
fsm->rfd = Fopen(fsm->path, "r.ufdio");
if (fsm->rfd == NULL || Ferror(fsm->rfd)) {
- if (fsm->rfd) (void) fsmStage(fsm, FSM_RCLOSE);
+ if (fsm->rfd != NULL) (void) fsmStage(fsm, FSM_RCLOSE);
fsm->rfd = NULL;
rc = CPIOERR_OPEN_FAILED;
break;
}
+/*@=voidabstract@*/
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%s, \"r\") rfd %p rdbuf %p\n", cur,
fsm->path, fsm->rfd, fsm->rdbuf);
@@ -2244,20 +2231,18 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
rc = CPIOERR_READ_FAILED;
break;
case FSM_RCLOSE:
- if (fsm->rfd) {
+ if (fsm->rfd != NULL) {
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%p)\n", cur, fsm->rfd);
(void) Fclose(fsm->rfd);
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
}
fsm->rfd = NULL;
break;
case FSM_WOPEN:
fsm->wfd = Fopen(fsm->path, "w.ufdio");
if (fsm->wfd == NULL || Ferror(fsm->wfd)) {
- if (fsm->wfd) (void) fsmStage(fsm, FSM_WCLOSE);
+ if (fsm->wfd != NULL) (void) fsmStage(fsm, FSM_WCLOSE);
fsm->wfd = NULL;
rc = CPIOERR_OPEN_FAILED;
}
@@ -2274,13 +2259,11 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
rc = CPIOERR_WRITE_FAILED;
break;
case FSM_WCLOSE:
- if (fsm->wfd) {
+ if (fsm->wfd != NULL) {
if (_fsm_debug && (stage & FSM_SYSCALL))
rpmMessage(RPMMESS_DEBUG, " %8s (%p)\n", cur, fsm->wfd);
(void) Fclose(fsm->wfd);
- /*@-mods@*/
errno = saveerrno;
- /*@=mods@*/
}
fsm->wfd = NULL;
break;
diff --git a/lib/fsm.h b/lib/fsm.h
index dcaca2e46..9ca5c8786 100644
--- a/lib/fsm.h
+++ b/lib/fsm.h
@@ -297,8 +297,8 @@ int fsmMapAttrs(FSM_t fsm)
* @return 0 on success
*/
int fsmStage(/*@partial@*/ FSM_t fsm, fileStage stage)
- /*@globals fileSystem, internalState @*/
- /*@modifies fsm, fileSystem, internalState @*/;
+ /*@globals errno, fileSystem, internalState @*/
+ /*@modifies fsm, errno, fileSystem, internalState @*/;
#ifdef __cplusplus
}
diff --git a/lib/manifest.c b/lib/manifest.c
index 5ed880945..16795d7bd 100644
--- a/lib/manifest.c
+++ b/lib/manifest.c
@@ -74,9 +74,9 @@ int rpmReadPackageManifest(FD_t fd, int * argcPtr, const char *** argvPtr)
const char ** av = NULL;
int argc = (argcPtr ? *argcPtr : 0);
const char ** argv = (argvPtr ? *argvPtr : NULL);
- /*@-type@*/ /* FIX: cast? */
- FILE * f = fdGetFp(fd);
- /*@=type@*/
+/*@+voidabstract@*/
+ FILE * f = (FILE *) fdGetFp(fd);
+/*@=voidabstract@*/
int rc = 0;
int i;
diff --git a/lib/misc.c b/lib/misc.c
index bb94c54b4..0288e3987 100644
--- a/lib/misc.c
+++ b/lib/misc.c
@@ -18,9 +18,6 @@ const char * RPMVERSION = VERSION;
#include "misc.h"
#include "debug.h"
-/*@access Header@*/ /* XXX compared with NULL */
-/*@access FD_t@*/ /* XXX compared with NULL */
-
rpmRC rpmMkdirPath (const char * dpath, const char * dname)
{
struct stat st;
@@ -220,7 +217,7 @@ int makeTempFile(const char * prefix, const char ** fnptr, FD_t * fdptr)
errxit:
tempfn = _free(tempfn);
/*@-usereleased@*/
- if (fd) (void) Fclose(fd);
+ if (fd != NULL) (void) Fclose(fd);
/*@=usereleased@*/
return 1;
}
diff --git a/lib/package.c b/lib/package.c
index 5b70fd6c6..c8d1f32d1 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -23,7 +23,6 @@
/*@access pgpDig @*/
/*@access pgpDigParams @*/
-/*@access rpmts @*/
/*@access Header @*/ /* XXX compared with NULL */
/*@access entryInfo @*/ /* XXX headerCheck */
/*@access indexEntry @*/ /* XXX headerCheck */
diff --git a/lib/psm.c b/lib/psm.c
index f5fd426e8..75891685f 100644
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -40,12 +40,7 @@
/*@unchecked@*/
int _psm_debug = _PSM_DEBUG;
-/*@access Header @*/ /* compared with NULL */
-/*@access rpmdbMatchIterator @*//* compared with NULL */
-/*@access FD_t @*/ /* compared with NULL */
-/*@access rpmdb @*/ /* compared with NULL */
-
-/*@access FSM_t @*/ /* compared with NULL */
+/*@access FD_t @*/ /* XXX void ptr args */
/*@access rpmpsm @*/
/*@access rpmfi @*/
@@ -253,9 +248,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
int i;
memset(psm, 0, sizeof(*psm));
- /*@-assignexpose -usereleased @*/
psm->ts = rpmtsLink(ts, "InstallSourcePackage");
- /*@=assignexpose =usereleased @*/
rc = rpmReadPackageFile(ts, fd, "InstallSourcePackage", &h);
switch (rc) {
@@ -280,7 +273,7 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
goto exit;
}
- (void) rpmtsAddInstallElement(ts, h, NULL, 0, NULL);
+ (void) rpmtsAddInstallElement(ts, h, NULL, 0, NULL);
fi = rpmfiNew(ts, h, RPMTAG_BASENAMES, scareMem);
h = headerFree(h);
@@ -302,8 +295,8 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
/*@i@*/ (void) rpmInstallLoadMacros(fi, fi->h);
+ psm->fi = rpmfiLink(fi, NULL);
/*@-assignexpose -usereleased @*/
- psm->fi = fi;
psm->te = fi->te;
/*@=assignexpose =usereleased @*/
@@ -377,9 +370,12 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
/*@i@*/ fi->dnl = hfd(fi->dnl, -1);
fi->dc = 2;
- fi->dnl = xmalloc(fi->dc * sizeof(*fi->dnl) + fi->fc * sizeof(*fi->dil) +
- speclen + sourcelen);
+ fi->dnl = xmalloc(fi->dc * sizeof(*fi->dnl)
+ + fi->fc * sizeof(*fi->dil)
+ + speclen + sourcelen);
+ /*@-dependenttrans@*/
fi->dil = (int *)(fi->dnl + fi->dc);
+ /*@=dependenttrans@*/
memset(fi->dil, 0, fi->fc * sizeof(*fi->dil));
fi->dil[i] = 1;
/*@-dependenttrans@*/
@@ -416,12 +412,15 @@ exit:
_specdir = _free(_specdir);
_sourcedir = _free(_sourcedir);
- if (h) h = headerFree(h);
+ psm->fi = rpmfiFree(psm->fi);
+ psm->te = NULL;
+
+ if (h != NULL) h = headerFree(h);
/*@-branchstate@*/
- if (fi) {
+ if (fi != NULL) {
fi->te->h = headerFree(fi->te->h);
- if (fi->te->fd)
+ if (fi->te->fd != NULL)
(void) Fclose(fi->te->fd);
fi->te->fd = NULL;
fi->te = NULL;
@@ -429,9 +428,6 @@ exit:
}
/*@=branchstate@*/
- psm->fi = NULL;
- psm->te = NULL;
-
/* XXX nuke the added package(s). */
rpmtsClean(ts);
@@ -1676,7 +1672,7 @@ psm->te->h = headerLink(fi->h);
}
/* Add remove transaction id to header. */
- if (psm->oh)
+ if (psm->oh != NULL)
{ int_32 tid = rpmtsGetTid(ts);
xx = headerAddEntry(psm->oh, RPMTAG_REMOVETID,
RPM_INT32_TYPE, &tid, 1);
@@ -1933,7 +1929,7 @@ psm->te->h = headerLink(fi->h);
/* Restore root directory if changed. */
xx = rpmpsmStage(psm, PSM_CHROOT_OUT);
- if (psm->fd) {
+ if (psm->fd != NULL) {
saveerrno = errno; /* XXX FIXME: Fclose with libio destroys errno */
xx = Fclose(psm->fd);
psm->fd = NULL;
@@ -1967,13 +1963,15 @@ psm->te->h = headerLink(fi->h);
/*@=nullstate@*/
}
+/*@-branchstate@*/
if (psm->goal == PSM_PKGERASE || psm->goal == PSM_PKGSAVE) {
-if (psm->te)
-if (psm->te->h)
+if (psm->te != NULL)
+if (psm->te->h != NULL)
psm->te->h = headerFree(psm->te->h);
- if (fi->h)
+ if (fi->h != NULL)
fi->h = headerFree(fi->h);
}
+/*@=branchstate@*/
psm->oh = headerFree(psm->oh);
psm->pkgURL = _free(psm->pkgURL);
psm->rpmio_flags = _free(psm->rpmio_flags);
@@ -2096,11 +2094,11 @@ assert(psm->mi == NULL);
&fi->record, sizeof(fi->record));
fi->h = rpmdbNextIterator(psm->mi);
- if (fi->h)
+ if (fi->h != NULL)
fi->h = headerLink(fi->h);
psm->mi = rpmdbFreeIterator(psm->mi);
- rc = (fi->h ? RPMRC_OK : RPMRC_FAIL);
+ rc = (fi->h != NULL ? RPMRC_OK : RPMRC_FAIL);
break;
case PSM_RPMDB_ADD:
if (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST) break;
diff --git a/lib/query.c b/lib/query.c
index 029772203..fb757d12d 100644
--- a/lib/query.c
+++ b/lib/query.c
@@ -22,10 +22,6 @@
#include "debug.h"
-/*@access rpmdbMatchIterator@*/ /* XXX compared with NULL */
-/*@access Header@*/ /* XXX compared with NULL */
-/*@access FD_t@*/ /* XXX compared with NULL */
-
/**
*/
static void printFileInfo(char * te, const char * name,
@@ -446,7 +442,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fileURL,
Fstrerror(fd));
- if (fd) (void) Fclose(fd);
+ if (fd != NULL) (void) Fclose(fd);
res = 1;
/*@loopbreak@*/ break;
}
@@ -493,7 +489,7 @@ restart:
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), fileURL,
Fstrerror(fd));
- if (fd) (void) Fclose(fd);
+ if (fd != NULL) (void) Fclose(fd);
res = 1;
/*@loopbreak@*/ break;
}
diff --git a/lib/rpmchecksig.c b/lib/rpmchecksig.c
index 55ad5c4c7..9207cf2a3 100644
--- a/lib/rpmchecksig.c
+++ b/lib/rpmchecksig.c
@@ -17,7 +17,6 @@
#include "misc.h" /* XXX for makeTempFile() */
#include "debug.h"
-/*?access Header @*/ /* XXX compared with NULL */
/*@access FD_t @*/ /* XXX stealing digests */
/*@access pgpDig @*/
/*@access pgpDigParams @*/
diff --git a/lib/rpminstall.c b/lib/rpminstall.c
index 57ee3369c..d4970c3ef 100644
--- a/lib/rpminstall.c
+++ b/lib/rpminstall.c
@@ -17,10 +17,6 @@
#include "debug.h"
/*@access rpmts @*/ /* XXX ts->goal, ts->dbmode */
-/*@access rpmps @*/ /* XXX compared with NULL */
-/*@access Header @*/ /* XXX compared with NULL */
-/*@access rpmdb @*/ /* XXX compared with NULL */
-/*@access FD_t @*/ /* XXX compared with NULL */
/*@access IDTX @*/
/*@access IDT @*/
@@ -103,15 +99,15 @@ void * rpmShowProgress(/*@null@*/ const void * arg,
/*@modifies rpmcliHashesCurrent, rpmcliProgressCurrent, rpmcliProgressTotal,
fileSystem @*/
{
- /*@-castexpose@*/
+/*@-abstract -castexpose @*/
Header h = (Header) arg;
- /*@=castexpose@*/
+/*@=abstract =castexpose @*/
char * s;
int flags = (int) ((long)data);
void * rc = NULL;
- /*@-assignexpose -abstract @*/
+/*@-abstract -assignexpose @*/
const char * filename = (const char *)key;
- /*@=assignexpose =abstract @*/
+/*@=abstract =assignexpose @*/
static FD_t fd = NULL;
int xx;
@@ -126,21 +122,23 @@ void * rpmShowProgress(/*@null@*/ const void * arg,
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), filename,
Fstrerror(fd));
- if (fd) {
+ if (fd != NULL) {
xx = Fclose(fd);
fd = NULL;
}
} else
fd = fdLink(fd, "persist (showProgress)");
/*@=type@*/
- return fd;
+/*@+voidabstract@*/
+ return (void *)fd;
+/*@=voidabstract@*/
/*@notreached@*/ break;
case RPMCALLBACK_INST_CLOSE_FILE:
/*@-type@*/ /* FIX: still necessary? */
fd = fdFree(fd, "persist (showProgress)");
/*@=type@*/
- if (fd) {
+ if (fd != NULL) {
xx = Fclose(fd);
fd = NULL;
}
@@ -463,7 +461,7 @@ if (fileURL[0] == '=') {
if (eiu->fd == NULL || Ferror(eiu->fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *eiu->fnp,
Fstrerror(eiu->fd));
- if (eiu->fd) {
+ if (eiu->fd != NULL) {
xx = Fclose(eiu->fd);
eiu->fd = NULL;
}
@@ -594,7 +592,7 @@ maybe_manifest:
if (eiu->fd == NULL || Ferror(eiu->fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), *eiu->fnp,
Fstrerror(eiu->fd));
- if (eiu->fd) {
+ if (eiu->fd != NULL) {
xx = Fclose(eiu->fd);
eiu->fd = NULL;
}
@@ -697,7 +695,7 @@ maybe_manifest:
if (eiu->fd == NULL || Ferror(eiu->fd)) {
rpmMessage(RPMMESS_ERROR, _("cannot open file %s: %s\n"),
eiu->sourceURL[i], Fstrerror(eiu->fd));
- if (eiu->fd) {
+ if (eiu->fd != NULL) {
xx = Fclose(eiu->fd);
eiu->fd = NULL;
}
@@ -842,7 +840,7 @@ int rpmInstallSource(rpmts ts, 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) (void) Fclose(fd);
+ if (fd != NULL) (void) Fclose(fd);
return 1;
}
@@ -968,7 +966,6 @@ rpmMessage(RPMMESS_DEBUG, "IDTXload(%p, %d)\n", ts, tag);
idt = idtx->idt + idtx->nidt;
/*@=nullderef@*/
idt->h = headerLink(h);
-rpmMessage(RPMMESS_DEBUG, "\tidt %p h %p\n", idt, idt->h);
idt->key = NULL;
idt->instance = rpmdbGetIteratorOffset(mi);
idt->val.u32 = *tidp;
@@ -994,10 +991,8 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
int xx;
int i;
-rpmMessage(RPMMESS_DEBUG, "IDTXglob(%p, %s, %d)\n", ts, globstr, tag);
av = NULL; ac = 0;
xx = rpmGlob(globstr, &ac, &av);
-rpmMessage(RPMMESS_DEBUG, "\txx %d ac %d av %p\n", xx, ac, av);
if (xx == 0)
for (i = 0; i < ac; i++) {
@@ -1005,12 +1000,11 @@ rpmMessage(RPMMESS_DEBUG, "\txx %d ac %d av %p\n", xx, ac, av);
int_32 count;
int isSource;
-rpmMessage(RPMMESS_DEBUG, "\tav[%d] %s\n", i, av[i]);
fd = Fopen(av[i], "r.ufdio");
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), av[i],
Fstrerror(fd));
- if (fd) (void) Fclose(fd);
+ if (fd != NULL) (void) Fclose(fd);
continue;
}
@@ -1056,8 +1050,6 @@ bottom:
av[i] = _free(av[i]);
av = _free(av); ac = 0;
-rpmMessage(RPMMESS_DEBUG, "IDTXglob: returns %p\n", idtx);
-
return idtx;
}
@@ -1109,7 +1101,6 @@ int rpmRollback(rpmts ts, struct rpmInstallArguments_s * ia, const char ** argv)
ip = NULL;
niids = 0;
}
-rpmMessage(RPMMESS_DEBUG, "*** was installed, now remove %p[%d]\n", ip, niids);
{ const char * globstr = rpmExpand("%{_repackage_dir}/*.rpm", NULL);
if (globstr == NULL || *globstr == '%') {
@@ -1128,7 +1119,6 @@ rpmMessage(RPMMESS_DEBUG, "*** was installed, now remove %p[%d]\n", ip, niids);
}
globstr = _free(globstr);
}
-rpmMessage(RPMMESS_DEBUG, "*** was removed, now install %p[%d]\n", rp, nrids);
{ int notifyFlags, xx;
notifyFlags = ia->installInterfaceFlags | (rpmIsVerbose() ? INSTALL_LABEL : 0 );
diff --git a/lib/rpmrc.c b/lib/rpmrc.c
index acf6bc6b0..1dbc4b1a8 100644
--- a/lib/rpmrc.c
+++ b/lib/rpmrc.c
@@ -1,5 +1,4 @@
/*@-bounds@*/
-/*@-mods@*/
#include "system.h"
#include <stdarg.h>
@@ -21,8 +20,6 @@
#include "misc.h"
#include "debug.h"
-/*@access FD_t@*/ /* compared with NULL */
-
/*@observer@*/ /*@unchecked@*/
static const char *defrcfiles = LIBRPMRC_FILENAME ":" VENDORRPMRC_FILENAME ":/etc/rpmrc:~/.rpmrc";
@@ -145,23 +142,22 @@ static int defaultsInitialized = 0;
/* prototypes */
static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
- /*@globals rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@modifies fd, fileSystem, internalState @*/;
+ /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
+ /*@modifies fd, rpmGlobalMacroContext, fileSystem, internalState @*/;
static void rpmSetVarArch(int var, const char * val,
/*@null@*/ const char * arch)
- /*@globals internalState @*/
- /*@modifies internalState @*/;
+ /*@globals values, internalState @*/
+ /*@modifies values, internalState @*/;
static void rebuildCompatTables(int type, const char * name)
/*@globals internalState @*/
/*@modifies internalState @*/;
static void rpmRebuildTargetVars(/*@null@*/ const char **target, /*@null@*/ const char ** canontarget)
- /*@globals rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@modifies *canontarget, fileSystem, internalState @*/;
+ /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
+ /*@modifies *canontarget, rpmGlobalMacroContext,
+ fileSystem, internalState @*/;
static int optionCompare(const void * a, const void * b)
/*@*/
@@ -454,9 +450,8 @@ const char * lookupInDefaultTable(const char * name,
static void setVarDefault(int var, const char * macroname, const char * val,
/*@null@*/ const char * body)
- /*@globals rpmGlobalMacroContext,
- internalState @*/
- /*@modifies internalState @*/
+ /*@globals rpmGlobalMacroContext, internalState @*/
+ /*@modifies rpmGlobalMacroContext, internalState @*/
{
if (var >= 0) { /* XXX Dying ... */
if (rpmGetVar(var)) return;
@@ -468,9 +463,8 @@ static void setVarDefault(int var, const char * macroname, const char * val,
}
static void setPathDefault(int var, const char * macroname, const char * subdir)
- /*@globals rpmGlobalMacroContext,
- internalState @*/
- /*@modifies internalState @*/
+ /*@globals rpmGlobalMacroContext, internalState @*/
+ /*@modifies rpmGlobalMacroContext, internalState @*/
{
if (var >= 0) { /* XXX Dying ... */
@@ -520,9 +514,8 @@ export RPM_BUILD_ROOT\n}\
";
static void setDefaults(void)
- /*@globals rpmGlobalMacroContext,
- internalState @*/
- /*@modifies internalState @*/
+ /*@globals rpmGlobalMacroContext, internalState @*/
+ /*@modifies rpmGlobalMacroContext, internalState @*/
{
addMacro(NULL, "_usr", NULL, "/usr", RMIL_DEFAULT);
@@ -559,9 +552,8 @@ static void setDefaults(void)
/*@-usedef@*/ /*@ FIX: se usage inconsistent, W2DO? */
static int doReadRC( /*@killref@*/ FD_t fd, const char * urlfn)
- /*@globals rpmGlobalMacroContext,
- fileSystem, internalState @*/
- /*@modifies fd, fileSystem, internalState @*/
+ /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
+ /*@modifies fd, rpmGlobalMacroContext, fileSystem, internalState @*/
{
const char *s;
char *se, *next;
@@ -1373,6 +1365,8 @@ static void freeRpmVar(/*@only@*/ struct rpmvarValue * orig)
}
void rpmSetVar(int var, const char * val)
+ /*@globals values @*/
+ /*@modifies values @*/
{
/*@-immediatetrans@*/
freeRpmVar(&values[var]);
@@ -1381,7 +1375,6 @@ void rpmSetVar(int var, const char * val)
}
static void rpmSetVarArch(int var, const char * val, const char * arch)
- /*@*/
{
struct rpmvarValue * next = values + var;
@@ -1417,6 +1410,8 @@ static void rpmSetVarArch(int var, const char * val, const char * arch)
}
void rpmSetTables(int archTable, int osTable)
+ /*@globals currTables @*/
+ /*@modifies currTables @*/
{
const char * arch, * os;
@@ -1449,6 +1444,8 @@ void rpmGetMachine(const char ** arch, const char ** os)
}
void rpmSetMachine(const char * arch, const char * os)
+ /*@globals current @*/
+ /*@modifies current @*/
{
const char * host_cpu, * host_os;
@@ -1642,6 +1639,10 @@ static void rpmRebuildTargetVars(const char ** target, const char ** canontarget
}
void rpmFreeRpmrc(void)
+ /*@globals current, tables, values, defaultsInitialized,
+ platpat, nplatpat @*/
+ /*@modifies current, tables, values, defaultsInitialized,
+ platpat, nplatpat @*/
{
int i, j, k;
@@ -1721,9 +1722,9 @@ void rpmFreeRpmrc(void)
* @return 0 on succes
*/
static int rpmReadRC(/*@null@*/ const char * rcfiles)
- /*@globals rpmGlobalMacroContext, rpmCLIMacroContext,
- fileSystem, internalState @*/
- /*@modifies rpmGlobalMacroContext,
+ /*@globals defaultsInitialized, rpmGlobalMacroContext,
+ rpmCLIMacroContext, fileSystem, internalState @*/
+ /*@modifies defaultsInitialized, rpmGlobalMacroContext,
fileSystem, internalState @*/
{
char *myrcfiles, *r, *re;
@@ -1894,5 +1895,4 @@ int rpmShowRC(FILE * fp)
return 0;
}
-/*@=mods@*/
/*@=bounds@*/
diff --git a/lib/rpmte.c b/lib/rpmte.c
index 6e373b9d7..f6d4b2e5a 100644
--- a/lib/rpmte.c
+++ b/lib/rpmte.c
@@ -21,7 +21,6 @@ int _rpmte_debug = 0;
/*@access alKey @*/
/*@access rpmtsi @*/
-/*@access rpmts @*/
void rpmteCleanDS(rpmte te)
{
@@ -54,10 +53,8 @@ static void delTE(rpmte p)
p->fi = rpmfiFree(p->fi);
- /*@-noeffectuncon@*/
if (p->fd != NULL)
p->fd = fdFree(p->fd, "delTE");
- /*@=noeffectuncon@*/
p->os = _free(p->os);
p->arch = _free(p->arch);
diff --git a/lib/rpmts.c b/lib/rpmts.c
index 97a44c927..0ea182914 100644
--- a/lib/rpmts.c
+++ b/lib/rpmts.c
@@ -52,12 +52,10 @@ extern int statvfs (const char * file, /*@out@*/ struct statvfs * buf)
/*@access rpmdb @*/ /* XXX db->db_chrootDone, NULL */
-/*@access FD_t @*/ /* XXX compared with NULL */
/*@access rpmps @*/
/*@access rpmDiskSpaceInfo @*/
/*@access rpmte @*/
/*@access rpmtsi @*/
-/*@access rpmts @*/
/*@access fnpyKey @*/
/*@access pgpDig @*/
/*@access pgpDigParams @*/
@@ -463,7 +461,7 @@ int rpmtsSolve(rpmts ts, rpmds ds, /*@unused@*/ const void * data)
if (fd == NULL || Ferror(fd)) {
rpmError(RPMERR_OPEN, _("open of %s failed: %s\n"), str,
Fstrerror(fd));
- if (fd) {
+ if (fd != NULL) {
xx = Fclose(fd);
fd = NULL;
}
@@ -777,9 +775,11 @@ void rpmtsSetScriptFd(rpmts ts, FD_t scriptFd)
ts->scriptFd = fdFree(ts->scriptFd, "rpmtsSetScriptFd");
ts->scriptFd = NULL;
}
+/*@+voidabstract@*/
if (scriptFd != NULL)
- ts->scriptFd = fdLink(scriptFd, "rpmtsSetScriptFd");
+ ts->scriptFd = fdLink((void *)scriptFd, "rpmtsSetScriptFd");
}
+/*@=voidabstract@*/
}
int rpmtsChrootDone(rpmts ts)
diff --git a/lib/signature.c b/lib/signature.c
index 58314ee47..ca4d8642f 100644
--- a/lib/signature.c
+++ b/lib/signature.c
@@ -18,10 +18,10 @@
#include "header_internal.h"
#include "debug.h"
+/*@access FD_t@*/ /* XXX ufdio->read arg1 is void ptr */
/*@access Header@*/ /* XXX compared with NULL */
/*@access entryInfo @*/ /* XXX rpmReadSignature */
/*@access indexEntry @*/ /* XXX rpmReadSignature */
-/*@access FD_t@*/ /* XXX compared with NULL */
/*@access DIGEST_CTX@*/ /* XXX compared with NULL */
/*@access pgpDig@*/
/*@access pgpDigParams@*/
@@ -724,7 +724,7 @@ exit:
}
SHA1 = _free(SHA1);
h = headerFree(h);
- if (fd) (void) Fclose(fd);
+ if (fd != NULL) (void) Fclose(fd);
return ret;
}
diff --git a/lib/transaction.c b/lib/transaction.c
index cd55bbe18..aff7f393b 100644
--- a/lib/transaction.c
+++ b/lib/transaction.c
@@ -30,11 +30,9 @@
#include "debug.h"
-/*@access FD_t @*/ /* XXX compared with NULL */
-/*@access Header @*/ /* XXX compared with NULL */
+/*@access Header @*/ /* XXX ts->notify arg1 is void ptr */
/*@access rpmps @*/ /* XXX need rpmProblemSetOK() */
/*@access dbiIndexSet @*/
-/*@access rpmdb @*/
/*@access rpmpsm @*/
diff --git a/lib/verify.c b/lib/verify.c
index 47da60152..29c0cfda5 100644
--- a/lib/verify.c
+++ b/lib/verify.c
@@ -13,13 +13,11 @@
#include "legacy.h" /* XXX domd5(), uidToUname(), gnameToGid */
#include "ugid.h"
-#include "misc.h" /* XXX for uidToUname() and gnameToGid() */
#include "debug.h"
/*@access rpmps @*/
/*@access rpmProblem @*/
/*@access rpmpsm @*/ /* XXX for %verifyscript through rpmpsmStage() */
-/*@access FD_t @*/ /* XXX compared with NULL */
#define S_ISDEV(m) (S_ISBLK((m)) || S_ISCHR((m)))
@@ -452,7 +450,7 @@ int showVerifyPackage(QVA_t qva, rpmts ts, Header h)
FD_t fdo = fdDup(STDOUT_FILENO);
if ((rc = rpmVerifyScript(qva, ts, fi, fdo)) != 0)
ec = rc;
- if (fdo)
+ if (fdo != NULL)
rc = Fclose(fdo);
}