Splint clean.
authorjbj <devnull@localhost>
Wed, 2 Apr 2003 21:16:26 +0000 (21:16 +0000)
committerjbj <devnull@localhost>
Wed, 2 Apr 2003 21:16:26 +0000 (21:16 +0000)
CVS patchset: 6729
CVS date: 2003/04/02 21:16:26

35 files changed:
beecrypt/entropy.c
build/buildio.h
file/compress.c
lib/.splintrc
lib/depends.c
lib/formats.c
lib/fs.c
lib/fsm.c
lib/fsm.h
lib/misc.c
lib/poptALL.c
lib/psm.c
lib/psm.h
lib/query.c
lib/rpmchecksig.c
lib/rpmds.c
lib/rpmds.h
lib/rpmfi.c
lib/rpmfi.h
lib/rpminstall.c
lib/rpmrc.c
lib/rpmte.c
lib/rpmte.h
lib/rpmts.h
lib/transaction.c
lib/verify.c
rpmio/digest.c
rpmio/fts.c
rpmio/fts.h
rpmio/rpmio_internal.h
rpmio/rpmpgp.h
rpmio/rpmsq.c
rpmio/rpmsq.h
rpmio/rpmsw.c
rpmio/rpmsw.h

index 077e85c..f71a459 100644 (file)
@@ -63,7 +63,7 @@
        extern int
 nanosleep (const struct timespec *__requested_time,
                       /*@out@*/ /*@null@*/ struct timespec *__remaining)
-       /*@modifies errno @*/;
+       /*@modifies *__remaining, errno @*/;
 
        extern void
 aio_init (const struct aioinit *__init)
index c342453..b38ba93 100644 (file)
@@ -15,7 +15,7 @@
 typedef /*@abstract@*/ struct cpioSourceArchive_s {
     unsigned int cpioArchiveSize;
     FD_t       cpioFdIn;
-/*@refcounted@*/
+/*@refcounted@*/ /*@relnull@*/
     rpmfi      cpioList;
 /*@only@*/
     struct rpmlead * lead;     /* XXX FIXME: exorcize lead/arch/os */
index 533fdc9..6fd8de3 100644 (file)
@@ -202,7 +202,8 @@ uncompressgzipped(const unsigned char *old,
 /*@=type@*/
 /*@=sizeoftype@*/
        if (rc != Z_OK) {
-               (void) fprintf(stderr,"%s: zlib: %s\n", __progname, z.msg);
+               fprintf(stderr,"%s: zlib: %s\n", __progname,
+                       (z.msg != NULL ? z.msg : ""));
                return 0;
        }
 
@@ -210,7 +211,8 @@ uncompressgzipped(const unsigned char *old,
        rc = inflate(&z, Z_SYNC_FLUSH);
 /*@=type@*/
        if (rc != Z_OK && rc != Z_STREAM_END) {
-               fprintf(stderr,"%s: zlib: %s\n", __progname, z.msg);
+               fprintf(stderr,"%s: zlib: %s\n", __progname,
+                       (z.msg != NULL ? z.msg : ""));
                return 0;
        }
 
index f84dc6e..165d898 100644 (file)
@@ -19,6 +19,8 @@
 -redecl
 -bufferoverflowhigh
 
+-nullpass
+
 # --- +partial artifacts
 -declundef
 -exportheadervar
index cf80ef4..8567599 100644 (file)
@@ -376,7 +376,9 @@ static int unsatisfiedDepend(rpmts ts, rpmds dep, int adding)
                memset(data, 0, sizeof(*data));
                data->data = datap;
                data->size = datalen;
+/*@-nullstate@*/ /* FIX: data->data may be NULL */
                xx = dbiGet(dbi, dbcursor, key, data, DB_SET);
+/*@=nullstate@*/
                DNEVR = key->data;
                DNEVRlen = key->size;
                datap = data->data;
index cf07474..a07a9fc 100644 (file)
@@ -244,7 +244,10 @@ static size_t xmlstrlen(const char * s)
     size_t len = 0;
     int c;
 
-    while ((c = *s++) != '\0') {
+/*@-boundsread@*/
+    while ((c = *s++) != '\0')
+/*@=boundsread@*/
+    {
        switch (c) {
        case '<': case '>':     len += 4;       /*@switchbreak@*/ break;
        case '&':               len += 5;       /*@switchbreak@*/ break;
@@ -262,6 +265,7 @@ static char * xmlstrcpy(/*@returned@*/ char * t, const char * s)
     char * te = t;
     int c;
 
+/*@-bounds@*/
     while ((c = *s++) != '\0') {
        switch (c) {
        case '<':       te = stpcpy(te, "&lt;");        /*@switchbreak@*/ break;
@@ -271,6 +275,7 @@ static char * xmlstrcpy(/*@returned@*/ char * t, const char * s)
        }
     }
     *te = '\0';
+/*@=bounds@*/
     return t;
 }
 
@@ -283,6 +288,7 @@ static char * xmlstrcpy(/*@returned@*/ char * t, const char * s)
  * @param element      (unused)
  * @return             formatted string
  */
+/*@-bounds@*/
 static /*@only@*/ char * xmlFormat(int_32 type, const void * data, 
                char * formatPrefix, int padding,
                /*@unused@*/ int element)
@@ -294,7 +300,9 @@ static /*@only@*/ char * xmlFormat(int_32 type, const void * data,
     const char * s = NULL;
     char * t, * te;
     unsigned long anint = 0;
+    int xx;
 
+/*@-branchstate@*/
     switch (type) {
     case RPM_I18NSTRING_TYPE:
     case RPM_STRING_TYPE:
@@ -303,9 +311,15 @@ static /*@only@*/ char * xmlFormat(int_32 type, const void * data,
        break;
     case RPM_BIN_TYPE:
     {  int cpl = b64encode_chars_per_line;
+/*@-mods@*/
        b64encode_chars_per_line = 0;
+/*@=mods@*/
+/*@-formatconst@*/
        s = base64Format(type, data, formatPrefix, padding, element);
+/*@=formatconst@*/
+/*@-mods@*/
        b64encode_chars_per_line = cpl;
+/*@=mods@*/
        xtag = "base64";
     }  break;
     case RPM_CHAR_TYPE:
@@ -324,14 +338,17 @@ static /*@only@*/ char * xmlFormat(int_32 type, const void * data,
        return xstrdup(_("(invalid xml type)"));
        /*@notreached@*/ break;
     }
+/*@=branchstate@*/
 
+/*@-branchstate@*/
     if (s == NULL) {
        int tlen = 32;
        t = memset(alloca(tlen+1), 0, tlen+1);
-       snprintf(t, tlen, "%lu", anint);
+       xx = snprintf(t, tlen, "%lu", anint);
        s = t;
        xtag = "integer";
     }
+/*@=branchstate@*/
 
     nb = 2 * strlen(xtag) + sizeof("\t<></>") + xmlstrlen(s);
     te = t = alloca(nb);
@@ -341,19 +358,24 @@ static /*@only@*/ char * xmlFormat(int_32 type, const void * data,
     te = stpcpy( stpcpy( stpcpy(te, "</"), xtag), ">");
 
     /* XXX s was malloc'd */
+/*@-branchstate@*/
     if (!strcmp(xtag, "base64"))
        s = _free(s);
+/*@=branchstate@*/
 
     nb += padding;
     val = xmalloc(nb+1);
 /*@-boundswrite@*/
     strcat(formatPrefix, "s");
 /*@=boundswrite@*/
-    snprintf(val, nb, formatPrefix, t);
+/*@-formatconst@*/
+    xx = snprintf(val, nb, formatPrefix, t);
+/*@=formatconst@*/
     val[nb] = '\0';
 
     return val;
 }
+/*@=bounds@*/
 
 /**
  * Display signature fingerprint and time.
index cf473e0..f78582b 100644 (file)
--- a/lib/fs.c
+++ b/lib/fs.c
 /*@-usereleased -onlytrans@*/
 
 struct fsinfo {
-/*@only@*/ const char * mntPoint;      /*!< path to mount point. */
-    dev_t dev;                         /*!< devno for mount point. */
-    int rdonly;                                /*!< is mount point read only? */
+/*@only@*/ /*@relnull@*/
+    const char * mntPoint;     /*!< path to mount point. */
+    dev_t dev;                 /*!< devno for mount point. */
+    int rdonly;                        /*!< is mount point read only? */
 };
 
 /*@unchecked@*/
-/*@only@*/ /*@null@*/ static struct fsinfo * filesystems = NULL;
+/*@only@*/ /*@null@*/
+static struct fsinfo * filesystems = NULL;
 /*@unchecked@*/
-/*@only@*/ /*@null@*/ static const char ** fsnames = NULL;
+/*@only@*/ /*@null@*/
+static const char ** fsnames = NULL;
 /*@unchecked@*/
 static int numFilesystems = 0;
 
@@ -236,7 +239,9 @@ static int getFilesystemList(void)
     fsnames[numFilesystems] = NULL;
 /*@=boundswrite@*/
 
+/*@-nullstate@*/ /* FIX: fsnames[] may be NULL */
     return 0; 
+/*@=nullstate@*/
 }
 #endif /* HAVE_MNTCTL */
 
index 0f3eda7..edb6e9f 100644 (file)
--- a/lib/fsm.c
+++ b/lib/fsm.c
@@ -9,7 +9,10 @@
 #include <rpmlib.h>
 
 #include "cpio.h"
+
 #include "fsm.h"
+#define        fsmUNSAFE       fsmStage
+
 #include "rpmerr.h"
 
 #define        _RPMFI_INTERNAL
 #define        _FSM_DEBUG      0
 /*@unchecked@*/
 int _fsm_debug = _FSM_DEBUG;
+
+/*@-exportheadervar@*/
 /*@unchecked@*/
 int _fsm_threads = 0;
+/*@=exportheadervar@*/
 
 /* XXX Failure to remove is not (yet) cause for failure. */
 /*@-exportlocal -exportheadervar@*/
@@ -246,7 +252,7 @@ static /*@null@*/ void * dnlFreeIterator(/*@only@*//*@null@*/ const void * a)
 
 /** \ingroup payload
  */
-static inline int dnlCount(const DNLI_t dnli)
+static inline int dnlCount(/*@null@*/ const DNLI_t dnli)
        /*@*/
 {
     return (dnli ? dnli->fi->dc : 0);
@@ -254,7 +260,7 @@ static inline int dnlCount(const DNLI_t dnli)
 
 /** \ingroup payload
  */
-static inline int dnlIndex(const DNLI_t dnli)
+static inline int dnlIndex(/*@null@*/ const DNLI_t dnli)
        /*@*/
 {
     return (dnli ? dnli->isave : -1);
@@ -268,7 +274,8 @@ static inline int dnlIndex(const DNLI_t dnli)
  */
 /*@-boundsread@*/
 /*@-usereleased@*/
-static /*@only@*/ void * dnlInitIterator(/*@special@*/ const FSM_t fsm,
+static /*@only@*/ /*@null@*/
+void * dnlInitIterator(/*@special@*/ const FSM_t fsm,
                int reverse)
        /*@uses fsm->iter @*/ 
        /*@*/
@@ -357,7 +364,8 @@ static /*@only@*/ void * dnlInitIterator(/*@special@*/ const FSM_t fsm,
  * @return             next directory name
  */
 /*@-boundsread@*/
-static /*@observer@*/ const char * dnlNextIterator(/*@null@*/ DNLI_t dnli)
+static /*@observer@*/ /*@null@*/
+const char * dnlNextIterator(/*@null@*/ DNLI_t dnli)
        /*@modifies dnli @*/
 {
     const char * dn = NULL;
@@ -382,14 +390,18 @@ static /*@observer@*/ const char * dnlNextIterator(/*@null@*/ DNLI_t dnli)
 /*@=boundsread@*/
 
 static void * fsmThread(void * arg)
-       /*@modifies arg @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies arg, fileSystem, internalState @*/
 {
     FSM_t fsm = arg;
+/*@-unqualifiedtrans@*/
     return ((void *) fsmStage(fsm, fsm->nstage));
+/*@=unqualifiedtrans@*/
 }
 
 int fsmNext(FSM_t fsm, fileStage nstage)
-       /*@modifies fsm @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     fsm->nstage = nstage;
     if (_fsm_threads)
@@ -407,8 +419,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 errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     struct stat * st = &fsm->sb;
     int rc = 0;
@@ -583,7 +595,9 @@ int fsmSetup(FSM_t fsm, fileStage goal,
        *fsm->archiveSize = (fdGetCpioPos(fsm->cfd) - pos);
 /*@=boundswrite@*/
 
+/*@-nullstate@*/ /* FIX: *fsm->failedFile may be NULL */
    return ec;
+/*@=nullstate@*/
 }
 
 int fsmTeardown(FSM_t fsm)
@@ -759,10 +773,11 @@ int fsmMapAttrs(FSM_t fsm)
  * @param fsm          file state machine data
  * @return             0 on success
  */
+/*@-compdef@*/
 static int expandRegular(/*@special@*/ FSM_t fsm)
-       /*@uses fsm->sb @*/
-       /*@globals errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@uses fsm->fmd5sum, fsm->md5sum, fsm->sb, fsm->wfd  @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     const struct stat * st = &fsm->sb;
     int left = st->st_size;
@@ -772,7 +787,7 @@ static int expandRegular(/*@special@*/ FSM_t fsm)
     if (rc)
        goto exit;
 
-    if (st->st_size > 0 && (fsm->fmd5sum || fsm->md5sum))
+    if (st->st_size > 0 && (fsm->fmd5sum != NULL || fsm->md5sum != NULL))
        fdInitDigest(fsm->wfd, PGPHASHALGO_MD5, 0);
 
     while (left) {
@@ -819,6 +834,7 @@ exit:
     (void) fsmNext(fsm, FSM_WCLOSE);
     return rc;
 }
+/*@=compdef@*/
 
 /** \ingroup payload
  * Write next item to payload stream.
@@ -826,10 +842,11 @@ exit:
  * @param writeData    should data be written?
  * @return             0 on success
  */
-static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
+/*@-compdef -compmempass@*/
+static int writeFile(/*@special@*/ /*@partial@*/ FSM_t fsm, int writeData)
        /*@uses fsm->path, fsm->opath, fsm->sb, fsm->osb, fsm->cfd @*/
-       /*@globals errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     const char * path = fsm->path;
     const char * opath = fsm->opath;
@@ -859,7 +876,6 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
     /*@=branchstate@*/
 
     if (fsm->mapFlags & CPIO_MAP_ABSOLUTE) {
-/*@-compdef@*/ /* FIX: dirName/baseName annotations ? */
 /*@-boundswrite@*/
        int nb = strlen(fsm->dirName) + strlen(fsm->baseName) + sizeof(".");
        char * t = alloca(nb);
@@ -869,7 +885,6 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
            *t++ = '.';
        t = stpcpy( stpcpy(t, fsm->dirName), fsm->baseName);
 /*@=boundswrite@*/
-/*@=compdef@*/
     } else if (fsm->mapFlags & CPIO_MAP_PATH) {
        rpmfi fi = fsmGetFi(fsm);
        fsm->path =
@@ -926,14 +941,18 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
        }
 
 #if HAVE_MMAP
+/*@-branchstate@*/
        if (mapped != (void *)-1) {
            xx = msync(mapped, nmapped, MS_ASYNC);
 #if defined(MADV_DONTNEED)
            xx = madvise(mapped, nmapped, MADV_DONTNEED);
 #endif
-           /*@-noeffect@*/ xx = munmap(mapped, nmapped) /*@=noeffect@*/;
+/*@-noeffect@*/
+           xx = munmap(mapped, nmapped);
+/*@=noeffect@*/
            fsm->rdbuf = rdbuf;
        }
+/*@=branchstate@*/
 #endif
 
     } else if (writeData && S_ISLNK(st->st_mode)) {
@@ -954,22 +973,23 @@ static int writeFile(/*@special@*/ FSM_t fsm, int writeData)
 exit:
     if (fsm->rfd != NULL)
        (void) fsmNext(fsm, FSM_RCLOSE);
-    /*@-dependenttrans@*/
+/*@-dependenttrans@*/
     fsm->opath = opath;
     fsm->path = path;
-    /*@=dependenttrans@*/
+/*@=dependenttrans@*/
     return rc;
 }
+/*@=compdef =compmempass@*/
 
 /** \ingroup payload
  * Write set of linked files to payload stream.
  * @param fsm          file state machine data
  * @return             0 on success
  */
-static int writeLinkedFile(/*@special@*/ FSM_t fsm)
+static int writeLinkedFile(/*@special@*/ /*@partial@*/ FSM_t fsm)
        /*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->li, fsm->failedFile @*/
-       /*@globals errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     const char * path = fsm->path;
     const char * nsuffix = fsm->nsuffix;
@@ -983,12 +1003,15 @@ static int writeLinkedFile(/*@special@*/ FSM_t fsm)
     fsm->ix = -1;
 
 /*@-boundswrite@*/
+/*@-branchstate@*/
     for (i = fsm->li->nlink - 1; i >= 0; i--) {
 
        if (fsm->li->filex[i] < 0) continue;
 
        fsm->ix = fsm->li->filex[i];
+/*@-compdef@*/
        rc = fsmNext(fsm, FSM_MAP);
+/*@=compdef@*/
 
        /* Write data after last link. */
        rc = writeFile(fsm, (i == 0));
@@ -1000,6 +1023,7 @@ static int writeLinkedFile(/*@special@*/ FSM_t fsm)
        fsm->path = _free(fsm->path);
        fsm->li->filex[i] = -1;
     }
+/*@=branchstate@*/
 /*@=boundswrite@*/
 
     fsm->ix = iterIndex;
@@ -1014,10 +1038,11 @@ static int writeLinkedFile(/*@special@*/ FSM_t fsm)
  * @return             0 on success
  */
 /*@-boundsread@*/
-static int fsmMakeLinks(/*@special@*/ FSM_t fsm)
+/*@-compdef@*/
+static int fsmMakeLinks(/*@special@*/ /*@partial@*/ FSM_t fsm)
        /*@uses fsm->path, fsm->opath, fsm->nsuffix, fsm->ix, fsm->li @*/
-       /*@globals errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     const char * path = fsm->path;
     const char * opath = fsm->opath;
@@ -1071,6 +1096,7 @@ static int fsmMakeLinks(/*@special@*/ FSM_t fsm)
     fsm->opath = opath;
     return ec;
 }
+/*@=compdef@*/
 /*@=boundsread@*/
 
 /** \ingroup payload
@@ -1078,11 +1104,12 @@ static int fsmMakeLinks(/*@special@*/ FSM_t fsm)
  * @param fsm          file state machine data
  * @return             0 on success
  */
-static int fsmCommitLinks(/*@special@*/ FSM_t fsm)
+/*@-compdef@*/
+static int fsmCommitLinks(/*@special@*/ /*@partial@*/ FSM_t fsm)
        /*@uses fsm->path, fsm->nsuffix, fsm->ix, fsm->sb,
                fsm->li, fsm->links @*/
-       /*@globals errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     const char * path = fsm->path;
     const char * nsuffix = fsm->nsuffix;
@@ -1119,16 +1146,17 @@ static int fsmCommitLinks(/*@special@*/ FSM_t fsm)
     fsm->path = path;
     return rc;
 }
+/*@=compdef@*/
 
 /**
  * Remove (if created) directories not explicitly included in package.
  * @param fsm          file state machine data
  * @return             0 on success
  */
-static int fsmRmdirs(/*@special@*/ FSM_t fsm)
+static int fsmRmdirs(/*@special@*/ /*@partial@*/ FSM_t fsm)
        /*@uses fsm->path, fsm->dnlx, fsm->ldn, fsm->rdbuf, fsm->iter @*/
-       /*@globals errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     const char * path = fsm->path;
     void * dnli = dnlInitIterator(fsm, 1);
@@ -1158,7 +1186,9 @@ static int fsmRmdirs(/*@special@*/ FSM_t fsm)
        do {
            if (*te == '/') {
                *te = '\0';
+/*@-compdef@*/
                rc = fsmNext(fsm, FSM_RMDIR);
+/*@=compdef@*/
                *te = '/';
            }
            if (rc)
@@ -1180,12 +1210,12 @@ static int fsmRmdirs(/*@special@*/ FSM_t fsm)
  * @param fsm          file state machine data
  * @return             0 on success
  */
-static int fsmMkdirs(/*@special@*/ FSM_t fsm)
+static int fsmMkdirs(/*@special@*/ /*@partial@*/ 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 errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
     struct stat * st = &fsm->sb;
     struct stat * ost = &fsm->osb;
@@ -1296,11 +1326,10 @@ static int fsmMkdirs(/*@special@*/ FSM_t fsm)
  * @param fsm          file state machine data
  * @return             0 on success
  */
-static int fsmStat(FSM_t fsm)
-       /*@globals errno, fileSystem, internalState @*/
-       /*@modifies fsm, errno, fileSystem, internalState @*/
+static int fsmStat(/*@special@*/ /*@partial@*/ FSM_t fsm)
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fsm, fileSystem, internalState @*/
 {
-    int saveerrno = errno;
     int rc = 0;
 
     if (fsm->path != NULL) {
@@ -1526,7 +1555,9 @@ int fsmStage(FSM_t fsm, fileStage stage)
 
        /* Detect and create directories not explicitly in package. */
        if (fsm->goal == FSM_PKGINSTALL) {
+/*@-compdef@*/
            rc = fsmNext(fsm, FSM_MKDIRS);
+/*@=compdef@*/
            if (!rc) fsm->mkdirsdone = 1;
        }
 
@@ -1683,7 +1714,9 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
                rc = fsmNext(fsm, FSM_RENAME);
                if (!rc)
                    rpmMessage(RPMMESS_WARNING,
-                       _("%s saved as %s\n"), fsm->opath, fsm->path);
+                       _("%s saved as %s\n"),
+                               (fsm->opath ? fsm->opath : ""),
+                               (fsm->path ? fsm->path : ""));
                fsm->path = _free(fsm->path);
                fsm->opath = opath;
            }
@@ -1818,7 +1851,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
            rc = fsmNext(fsm, FSM_RENAME);
            if (!rc) {
                rpmMessage(RPMMESS_WARNING, _("%s saved as %s\n"),
-                               fsm->opath, fsm->path);
+                               (fsm->opath ? fsm->opath : ""),
+                               (fsm->path ? fsm->path : ""));
            }
            fsm->path = _free(fsm->path);
            fsm->path = path;
@@ -1887,7 +1921,8 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
                if (!rc && fsm->nsuffix) {
                    const char * opath = fsmFsPath(fsm, st, NULL, NULL);
                    rpmMessage(RPMMESS_WARNING, _("%s created as %s\n"),
-                               (opath ? opath : ""), fsm->path);
+                               (opath ? opath : ""),
+                               (fsm->path ? fsm->path : ""));
                    opath = _free(opath);
                }
                fsm->opath = _free(fsm->opath);
@@ -2057,9 +2092,9 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
                fsm->path, (rc < 0 ? strerror(errno) : ""));
        if (rc < 0)
            switch (errno) {
-           case ENOENT:        rc = CPIOERR_ENOENT;    break;
-           case ENOTEMPTY:     rc = CPIOERR_ENOTEMPTY; break;
-           default:            rc = CPIOERR_RMDIR_FAILED; break;
+           case ENOENT:        rc = CPIOERR_ENOENT;    /*@switchbreak@*/ break;
+           case ENOTEMPTY:     rc = CPIOERR_ENOTEMPTY; /*@switchbreak@*/ break;
+           default:            rc = CPIOERR_RMDIR_FAILED; /*@switchbreak@*/ break;
            }
        break;
     case FSM_CHOWN:
index 2fe8e00..98ac8d5 100644 (file)
--- a/lib/fsm.h
+++ b/lib/fsm.h
@@ -93,9 +93,12 @@ typedef enum fileStage_e {
  * Keeps track of the set of all hard links to a file in an archive.
  */
 struct hardLink_s {
-/*@owned@*/ struct hardLink_s * next;
-/*@owned@*/ const char ** nsuffix;
-/*@owned@*/ int * filex;
+/*@owned@*/ /*@relnull@*/
+    struct hardLink_s * next;
+/*@owned@*/
+    const char ** nsuffix;
+/*@owned@*/
+    int * filex;
     struct stat sb;
     int nlink;
     int linksLeft;
@@ -118,23 +121,25 @@ struct fsmIterator_s {
  * File name and stat information.
  */
 struct fsm_s {
-/*@owned@*/
+/*@owned@*/ /*@relnull@*/
     const char * path;         /*!< Current file name. */
-/*@owned@*/
+/*@owned@*/ /*@relnull@*/
     const char * opath;                /*!< Original file name. */
+/*@relnull@*/
     FD_t cfd;                  /*!< Payload file handle. */
+/*@relnull@*/
     FD_t rfd;                  /*!<  read: File handle. */
-/*@dependent@*/
+/*@dependent@*/ /*@relnull@*/
     char * rdbuf;              /*!<  read: Buffer. */
-/*@owned@*/
+/*@owned@*/ /*@relnull@*/
     char * rdb;                        /*!<  read: Buffer allocated. */
     size_t rdsize;             /*!<  read: Buffer allocated size. */
     size_t rdlen;              /*!<  read: Number of bytes requested.*/
     size_t rdnb;               /*!<  read: Number of bytes returned. */
     FD_t wfd;                  /*!< write: File handle. */
-/*@dependent@*/
+/*@dependent@*/ /*@relnull@*/
     char * wrbuf;              /*!< write: Buffer. */
-/*@owned@*/
+/*@owned@*/ /*@relnull@*/
     char * wrb;                        /*!< write: Buffer allocated. */
     size_t wrsize;             /*!< write: Buffer allocated size. */
     size_t wrlen;              /*!< write: Number of bytes requested.*/
@@ -142,23 +147,23 @@ struct fsm_s {
 /*@only@*/ /*@null@*/
     FSMI_t iter;               /*!< File iterator. */
     int ix;                    /*!< Current file iterator index. */
-/*@only@*/
+/*@only@*/ /*@relnull@*/
     struct hardLink_s * links; /*!< Pending hard linked file(s). */
-/*@only@*/
+/*@only@*/ /*@relnull@*/
     struct hardLink_s * li;    /*!< Current hard linked file(s). */
 /*@kept@*/ /*@null@*/
     unsigned int * archiveSize;        /*!< Pointer to archive size. */
 /*@kept@*/ /*@null@*/
     const char ** failedFile;  /*!< First file name that failed. */
-/*@shared@*/
+/*@shared@*/ /*@relnull@*/
     const char * subdir;       /*!< Current file sub-directory. */
 /*@unused@*/
     char subbuf[64];   /* XXX eliminate */
-/*@observer@*/
+/*@observer@*/ /*@relnull@*/
     const char * osuffix;      /*!< Old, preserved, file suffix. */
-/*@observer@*/
+/*@observer@*/ /*@relnull@*/
     const char * nsuffix;      /*!< New, created, file suffix. */
-/*@shared@*/
+/*@shared@*/ /*@relnull@*/
     const char * suffix;       /*!< Current file suffix. */
     char sufbuf[64];   /* XXX eliminate */
 /*@only@*/ /*@null@*/
@@ -175,13 +180,13 @@ struct fsm_s {
     int rc;                    /*!< External file stage return code. */
     int commit;                        /*!< Commit synchronously? */
     cpioMapFlags mapFlags;     /*!< Bit(s) to control mapping. */
-/*@shared@*/
+/*@shared@*/ /*@relnull@*/
     const char * dirName;      /*!< File directory name. */
-/*@shared@*/
+/*@shared@*/ /*@relnull@*/
     const char * baseName;     /*!< File base name. */
-/*@shared@*/
+/*@shared@*/ /*@relnull@*/
     const char * fmd5sum;      /*!< Hex MD5 sum (NULL disables). */
-/*@shared@*/
+/*@shared@*/ /*@relnull@*/
     const char * md5sum;       /*!< Binary MD5 sum (NULL disables). */
     
     unsigned fflags;           /*!< File flags. */
@@ -215,14 +220,14 @@ extern "C" {
 
 /**
  * Create file state machine instance.
- * @return             file state machine data
+ * @return             file state machine
  */
 /*@only@*/ FSM_t newFSM(void)
        /*@*/;
 
 /**
  * Destroy file state machine instance.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  * @return             always NULL
  */
 /*@null@*/ FSM_t freeFSM(/*@only@*/ /*@null@*/ FSM_t fsm)
@@ -231,7 +236,7 @@ extern "C" {
 
 /**
  * Load external data into file state machine.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  * @param goal
  * @param ts           transaction set
  * @param fi           transaction element file info
@@ -252,7 +257,7 @@ int fsmSetup(FSM_t fsm, fileStage goal,
 
 /**
  * Clean file state machine.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  * @return             0 on success
  */
 int fsmTeardown(FSM_t fsm)
@@ -262,7 +267,7 @@ int fsmTeardown(FSM_t fsm)
 /*@-exportlocal@*/
 /**
  * Retrieve transaction set from file state machine iterator.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  * @return             transaction set
  */
 rpmts fsmGetTs(const FSM_t fsm)
@@ -270,7 +275,7 @@ rpmts fsmGetTs(const FSM_t fsm)
 
 /**
  * Retrieve transaction element file info from file state machine iterator.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  * @return             transaction element file info
  */
 rpmfi fsmGetFi(/*@partial@*/ const FSM_t fsm)
@@ -278,32 +283,40 @@ rpmfi fsmGetFi(/*@partial@*/ const FSM_t fsm)
 
 /**
  * Map next file path and action.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  */
 int fsmMapPath(FSM_t fsm)
        /*@modifies fsm @*/;
 
 /**
  * Map file stat(2) info.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  */
 int fsmMapAttrs(FSM_t fsm)
        /*@modifies fsm @*/;
 /*@=exportlocal@*/
 
+/**
+ * File state machine driver.
+ * @param fsm          file state machine
+ * @param nstage               next stage
+ * @return             0 on success
+ */
 int fsmNext(FSM_t fsm, fileStage nstage)
-       /*@modifies fsm @*/;
+       /*@globals errno, fileSystem, internalState @*/
+       /*@modifies fsm, errno, fileSystem, internalState @*/;
 
 /**
  * File state machine driver.
- * @param fsm          file state machine data
+ * @param fsm          file state machine
  * @param stage                next stage
  * @return             0 on success
  */
+/*@-exportlocal@*/
 int fsmStage(/*@partial@*/ FSM_t fsm, fileStage stage)
        /*@globals errno, fileSystem, internalState @*/
        /*@modifies fsm, errno, fileSystem, internalState @*/;
-#define        fsmUNSAFE       fsmStage
+/*@=exportlocal@*/
 
 #ifdef __cplusplus
 }
index 7bd6a15..f42c847 100644 (file)
@@ -84,7 +84,9 @@ char ** splitString(const char * str, int length, char sep)
 
     list[i] = NULL;
 
+/*@-nullret@*/ /* FIX: list[i] is NULL */
     return list;
+/*@=nullret@*/
 }
 /*@=bounds@*/
 
@@ -346,11 +348,15 @@ if (_debug)
 fprintf(stderr, "*** GLOB maxb %d diskURL %d %*s globURL %p %s\n", (int)maxb, (int)nb, (int)nb, av[j], globURL, globURL);
        
        /*@-branchstate@*/
+#ifdef DYING
        if (argc == 0)
            argv = xmalloc((gl.gl_pathc+1) * sizeof(*argv));
        else if (gl.gl_pathc > 0)
+#endif
            argv = xrealloc(argv, (argc+gl.gl_pathc+1) * sizeof(*argv));
        /*@=branchstate@*/
+
+       if (argv != NULL)
        for (i = 0; i < gl.gl_pathc; i++) {
            const char * globFile = &(gl.gl_pathv[i][0]);
            if (globRoot > globURL && globRoot[-1] == '/')
@@ -378,12 +384,16 @@ fprintf(stderr, "*** rpmGlob argv[%d] \"%s\"\n", argc, globURL);
 
 exit:
     av = _free(av);
+/*@-branchstate@*/
     if (rc || argvPtr == NULL) {
+/*@-dependenttrans -unqualifiedtrans@*/
        if (argv != NULL)
        for (i = 0; i < argc; i++)
            argv[i] = _free(argv[i]);
        argv = _free(argv);
+/*@=dependenttrans =unqualifiedtrans@*/
     }
+/*@=branchstate@*/
     return rc;
 }
 
index 08370fc..2bee3b8 100644 (file)
@@ -29,6 +29,8 @@ extern int _fps_debug;
 
 /*@unchecked@*/
 extern int _fsm_debug;
+
+/*@unchecked@*/
 extern int _fsm_threads;
 
 /*@unchecked@*/
@@ -36,6 +38,8 @@ extern int _hdr_debug;
 
 /*@unchecked@*/
 extern int _psm_debug;
+
+/*@unchecked@*/
 extern int _psm_threads;
 
 /*@unchecked@*/
index 78c227b..c755cf8 100644 (file)
--- a/lib/psm.c
+++ b/lib/psm.c
@@ -58,11 +58,11 @@ int rpmVersionCompare(Header first, Header second)
                        NULL))
        epochTwo = NULL;
 
-    if (epochOne && !epochTwo)
+    if (epochOne != NULL && epochTwo == NULL)
        return 1;
-    else if (!epochOne && epochTwo)
+    else if (epochOne == NULL && epochTwo != NULL)
        return -1;
-    else if (epochOne && epochTwo) {
+    else if (epochOne != NULL && epochTwo != NULL) {
 /*@-boundsread@*/
        if (*epochOne < *epochTwo)
            return -1;
@@ -285,6 +285,11 @@ rpmRC rpmInstallSourcePackage(rpmts ts, FD_t fd,
 /*@-onlytrans@*/       /* FIX: te reference */
     fi->te = rpmtsElement(ts, 0);
 /*@=onlytrans@*/
+    if (fi->te == NULL) {      /* XXX can't happen */
+       rc = RPMRC_FAIL;
+       goto exit;
+    }
+
 /*@-nullpass@*/                /* FIX fi->h may be null */
     fi->te->h = headerLink(fi->h);
 /*@=nullpass@*/
@@ -585,6 +590,7 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
     }
 
     maxPrefixLength = 0;
+    if (prefixes != NULL)
     for (i = 0; i < numPrefixes; i++) {
        len = strlen(prefixes[i]);
        if (len > maxPrefixLength) maxPrefixLength = len;
@@ -597,7 +603,7 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
 
        /*@-branchstate@*/
        if (makeTempFile((!rpmtsChrootDone(ts) ? rootDir : "/"), &fn, &fd)) {
-           if (freePrefixes) free(prefixes);
+           if (prefixes != NULL && freePrefixes) free(prefixes);
            return RPMRC_FAIL;
        }
        /*@=branchstate@*/
@@ -694,6 +700,7 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
            /*@=modobserver@*/
        }
 
+       if (prefixes != NULL)
        for (i = 0; i < numPrefixes; i++) {
            sprintf(prefixBuf, "RPM_INSTALL_PREFIX%d=%s", i, prefixes[i]);
            xx = doputenv(prefixBuf);
@@ -725,7 +732,9 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
                        psm->stepName, sln, n, v, r,
                        argv[0], (unsigned)getpid());
            unsetenv("MALLOC_CHECK_");
+/*@-nullstate@*/
            xx = execv(argv[0], (char *const *)argv);
+/*@=nullstate@*/
            break;
        default:
            break;
@@ -944,7 +953,7 @@ static rpmRC runTriggers(rpmpsm psm)
     if (numPackage < 0)
        return RPMRC_NOTFOUND;
 
-    if (fi->h != NULL) /* XXX can't happen */
+    if (fi != NULL && fi->h != NULL)   /* XXX can't happen */
     {  Header triggeredH;
        rpmdbMatchIterator mi;
        int countCorrection = psm->countCorrection;
@@ -1133,14 +1142,18 @@ rpmpsm rpmpsmNew(rpmts ts, rpmte te, rpmfi fi)
 }
 
 static void * rpmpsmThread(void * arg)
-       /*@modifies psm @*/
+       /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
+       /*@modifies arg, rpmGlobalMacroContext, fileSystem, internalState @*/
 {
     rpmpsm psm = arg;
+/*@-unqualifiedtrans@*/
     return ((void *) rpmpsmStage(psm, psm->nstage));
+/*@=unqualifiedtrans@*/
 }
 
 static int rpmpsmNext(rpmpsm psm, pkgStage nstage)
-       /*@modifies psm @*/
+       /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
+       /*@modifies psm, rpmGlobalMacroContext, fileSystem, internalState @*/
 {
     psm->nstage = nstage;
     if (_psm_threads)
index 866966e..c0d388e 100644 (file)
--- a/lib/psm.h
+++ b/lib/psm.h
@@ -68,9 +68,11 @@ struct rpmpsm_s {
     rpmts ts;                  /*!< transaction set */
 /*@dependent@*/ /*@null@*/
     rpmte te;                  /*!< current transaction element */
-/*@refcounted@*/
+/*@refcounted@*/ /*@relnull@*/
     rpmfi fi;                  /*!< transaction element file info */
+/*@relnull@*/
     FD_t cfd;                  /*!< Payload file handle. */
+/*@relnull@*/
     FD_t fd;                   /*!< Repackage file handle. */
     Header oh;                 /*!< Repackage header. */
 /*@null@*/
@@ -136,13 +138,13 @@ rpmpsm XrpmpsmUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm,
  * @param msg
  * @return             new package state machine reference
  */
-/*@unused@*/ /*@newref@*/
+/*@unused@*/ /*@newref@*/ /*@null@*/
 rpmpsm rpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg)
        /*@modifies psm @*/;
 
 /** @todo Remove debugging entry from the ABI. */
 /*@-exportlocal@*/
-/*@newref@*/
+/*@newref@*/ /*@null@*/
 rpmpsm XrpmpsmLink (/*@null@*/ rpmpsm psm, /*@null@*/ const char * msg,
                const char * fn, unsigned ln)
         /*@modifies psm @*/;
@@ -166,6 +168,7 @@ rpmpsm rpmpsmFree(/*@killref@*/ /*@only@*/ /*@null@*/ rpmpsm psm)
  * @param fi           file info set
  * @return             new package state machine
  */
+/*@null@*/
 rpmpsm rpmpsmNew(rpmts ts, /*@null@*/ rpmte te, rpmfi fi)
        /*@modifies ts, fi @*/;
 
index d14af10..c8102dc 100644 (file)
@@ -480,7 +480,9 @@ restart:
            }
            
            /* Read list of packages from manifest. */
+/*@-nullstate@*/ /* FIX: *av may be NULL */
            res = rpmReadPackageManifest(fd, &ac, &av);
+/*@=nullstate@*/
            if (res != RPMRC_OK) {
                rpmError(RPMERR_MANIFEST,
                        _("%s: not an rpm package (or package manifest): %s\n"),
index 9207cf2..de66dd9 100644 (file)
@@ -27,8 +27,9 @@ static int _print_pkts = 0;
 /**
  */
 /*@-boundsread@*/
-static int manageFile(FD_t *fdp, const char **fnp, int flags,
-               /*@unused@*/ int rc)
+static int manageFile(/*@out@*/ FD_t *fdp,
+               /*@null@*/ /*@out@*/ const char **fnp,
+               int flags, /*@unused@*/ int rc)
        /*@globals rpmGlobalMacroContext, fileSystem, internalState @*/
        /*@modifies *fdp, *fnp, rpmGlobalMacroContext,
                fileSystem, internalState @*/
@@ -36,9 +37,8 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
     const char *fn;
     FD_t fd;
 
-    if (fdp == NULL) { /* programmer error */
+    if (fdp == NULL)   /* programmer error */
        return 1;
-    }
 
 /*@-boundswrite@*/
     /* close and reset *fdp to NULL */
@@ -49,7 +49,7 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
     }
 
     /* open a file and set *fdp */
-    if (*fdp == NULL && fnp && *fnp) {
+    if (*fdp == NULL && fnp != NULL && *fnp != NULL) {
        fd = Fopen(*fnp, ((flags & O_WRONLY) ? "w.ufdio" : "r.ufdio"));
        if (fd == NULL || Ferror(fd)) {
            rpmError(RPMERR_OPEN, _("%s: open failed: %s\n"), *fnp,
@@ -67,7 +67,7 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
            rpmError(RPMERR_MAKETEMP, _("makeTempFile failed\n"));
            return 1;
        }
-       if (fnp)
+       if (fnp != NULL)
            *fnp = fn;
        *fdp = fdLink(fd, "manageFile return");
        fd = fdFree(fd, "manageFile return");
@@ -76,9 +76,8 @@ static int manageFile(FD_t *fdp, const char **fnp, int flags,
 /*@=boundswrite@*/
 
     /* no operation */
-    if (*fdp && fnp && *fnp) {
+    if (*fdp != NULL && fnp != NULL && *fnp != NULL)
        return 0;
-    }
 
     /* XXX never reached */
     return 1;
index 50cb1cf..78cc7da 100644 (file)
@@ -605,10 +605,13 @@ assert(argv[ac] != NULL);
        t = stpcpy(t, argv[ac]) + 1;
     }
     av[ac] = NULL;
+/*@-nullret@*/
     return av;
+/*@=nullret@*/
 }
 /*@=bounds@*/
 
+/*@null@*/
 static rpmds rpmdsDup(const rpmds ods)
        /*@modifies ods @*/
 {
@@ -707,6 +710,8 @@ int save;
     }
 /*@=branchstate@*/
     ds = *dsp;
+    if (ds == NULL)
+       return -1;
 
     /*
      * Add new entries.
index ec44887..9a027f0 100644 (file)
@@ -85,12 +85,12 @@ rpmds XrpmdsUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmds ds,
  * @param msg
  * @return             new dependency set reference
  */
-/*@unused@*/ /*@newref@*/
+/*@unused@*/ /*@newref@*/ /*@null@*/
 rpmds rpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg)
        /*@modifies ds @*/;
 
 /** @todo Remove debugging entry from the ABI. */
-/*@newref@*/
+/*@newref@*/ /*@null@*/
 rpmds XrpmdsLink (/*@null@*/ rpmds ds, /*@null@*/ const char * msg,
                const char * fn, unsigned ln)
         /*@modifies ds @*/;
index eae07fd..54522a8 100644 (file)
@@ -734,6 +734,9 @@ assert(p != NULL);
            fn = xrealloc(fn, fileAlloced);
        }
        /*@=branchstate@*/
+
+       if (fn == NULL)         /* XXX can't happen */
+           continue;
        *fn = '\0';
        fnlen = stpcpy( stpcpy(fn, dirNames[dirIndexes[i]]), baseNames[i]) - fn;
 
@@ -766,7 +769,9 @@ assert(p != NULL);
        }
        if (j < 0) continue;
 
+/*@-nullderef@*/ /* FIX: fModes may be NULL */
        ft = whatis(fModes[i]);
+/*@=nullderef@*/
 
        /* On install, a relocate to NULL means skip the path. */
        if (relocations[j].newPath == NULL) {
@@ -928,7 +933,9 @@ assert(p != NULL);
 
     baseNames = hfd(baseNames, RPM_STRING_ARRAY_TYPE);
     dirNames = hfd(dirNames, RPM_STRING_ARRAY_TYPE);
+/*@-dependenttrans@*/
     fn = _free(fn);
+/*@=dependenttrans@*/
 
     return h;
 }
index 0993be0..666c6d2 100644 (file)
@@ -44,9 +44,9 @@ struct rpmfi_s {
 /*@only@*/ /*?null?*/
     const char ** dnl;         /*!< Directory name(s) (from header) */
 
-/*@only@*/ /*?null?*/
+/*@only@*/ /*@relnull@*/
     const char ** fmd5s;       /*!< File MD5 sum(s) (from header) */
-/*@only@*/ /*?null?*/
+/*@only@*/ /*@relnull@*/
     const char ** flinks;      /*!< File link(s) (from header) */
 /*@only@*/ /*@null@*/
     const char ** flangs;      /*!< File lang(s) (from header) */
@@ -102,7 +102,7 @@ struct rpmfi_s {
     int_32 fc;                 /*!< No. of files. */
 
 /*=============================*/
-/*@dependent@*/
+/*@dependent@*/ /*@relnull@*/
     rpmte te;
 
     HGE_t hge;                 /*!< Vector to headerGetEntry() */
@@ -115,7 +115,7 @@ struct rpmfi_s {
     gid_t gid;                 /*!< File gid (default). */
     uint_32 flags;             /*!< File flags (default). */
     fileAction action;         /*!< File disposition (default). */
-/*@owned@*/
+/*@owned@*/ /*@relnull@*/
     fileAction * actions;      /*!< File disposition(s). */
 /*@owned@*/
     struct fingerPrint_s * fps;        /*!< File fingerprint(s). */
@@ -126,7 +126,7 @@ struct rpmfi_s {
 /*@unused@*/
     int_32 * odil;             /*!< Original dirindex(s) (from header) */
 
-/*@only@*/
+/*@only@*/ /*@relnull@*/
     unsigned char * md5s;      /*!< File md5 sums in binary. */
 
 /*@only@*/ /*@null@*/
@@ -197,7 +197,7 @@ rpmfi XrpmfiUnlink (/*@killref@*/ /*@only@*/ /*@null@*/ rpmfi fi,
  * @param msg
  * @return             new file info set reference
  */
-/*@unused@*/
+/*@unused@*/ /*@null@*/
 rpmfi rpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg)
        /*@modifies fi @*/;
 
@@ -208,6 +208,7 @@ rpmfi rpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg)
  * @param ln
  * @return             NULL always
  */
+/*@null@*/
 rpmfi XrpmfiLink (/*@null@*/ rpmfi fi, /*@null@*/ const char * msg,
                const char * fn, unsigned ln)
         /*@modifies fi @*/;
index 64b3c17..f0702c0 100644 (file)
@@ -601,7 +601,9 @@ maybe_manifest:
        }
 
        /* Read list of packages from manifest. */
+/*@-nullstate@*/ /* FIX: *eiu->argv can be NULL */
        rc = rpmReadPackageManifest(eiu->fd, &eiu->argc, &eiu->argv);
+/*@=nullstate@*/
        if (rc != RPMRC_OK)
            rpmError(RPMERR_MANIFEST, _("%s: not an rpm package (or package manifest): %s\n"),
                        *eiu->fnp, Fstrerror(eiu->fd));
@@ -1024,7 +1026,7 @@ IDTX IDTXglob(rpmts ts, const char * globstr, rpmTag tag)
 
        tidp = NULL;
        /*@-branchstate@*/
-       if (hge(h, tag, &type, (void **) &tidp, &count) && tidp) {
+       if (hge(h, tag, &type, (void **) &tidp, &count) && tidp != NULL) {
 
            idtx = IDTXgrow(idtx, 1);
            if (idtx == NULL || idtx->idt == NULL)
index 1dbc4b1..284f457 100644 (file)
@@ -28,7 +28,7 @@ const char * macrofiles = MACROFILES;
 
 /*@observer@*/ /*@unchecked@*/
 static const char * platform = "/etc/rpm/platform";
-/*@only@*/ /*@relnul@*/ /*@unchecked@*/
+/*@only@*/ /*@relnull@*/ /*@unchecked@*/
 static const char ** platpat = NULL;
 /*@unchecked@*/
 static int nplatpat = 0;
index 9003f53..e1e882f 100644 (file)
@@ -574,7 +574,7 @@ fprintf(stderr, "*** tsi %p ++ %s:%d\n", tsi, fn, ln);
  * @param tsi          transaction element iterator
  * @return             transaction element, NULL on termination
  */
-static /*@dependent@*/ /*@null@*/
+static /*@null@*/ /*@dependent@*/
 rpmte rpmtsiNextElement(rpmtsi tsi)
        /*@modifies tsi @*/
 {
index 0ac558f..6e1c78d 100644 (file)
@@ -59,7 +59,7 @@ struct tsortInfo_s {
 struct rpmte_s {
     rpmElementType type;       /*!< Package disposition (installed/removed). */
 
-/*@refcounted@*/ /*@null@*/
+/*@refcounted@*/ /*@relnull@*/
     Header h;                  /*!< Package header. */
 /*@only@*/
     const char * NEVR;         /*!< Package name-version-release. */
@@ -324,6 +324,7 @@ rpmte rpmteParent(rpmte te)
  * @param pte          new parent transaction element
  * @return             previous parent transaction element
  */
+/*@null@*/
 rpmte rpmteSetParent(rpmte te, rpmte pte)
        /*@modifies te @*/;
 
index f06aee4..26b9833 100644 (file)
@@ -115,6 +115,7 @@ struct rpmts_s {
 /*@null@*/
     int (*solve) (rpmts ts, rpmds key, const void * data)
        /*@modifies ts @*/;     /*!< Search for NEVRA key. */
+/*@relnull@*/
     const void * solveData;    /*!< Solve callback data */
     int nsuggests;             /*!< No. of depCheck suggestions. */
 /*@only@*/ /*@null@*/
@@ -722,8 +723,9 @@ int rpmtsNElements(rpmts ts)
  * Return (ordered) transaction set element.
  * @param ts           transaction set
  * @param ix           transaction element index
- * @return             transaction element
+ * @return             transaction element (or NULL)
  */
+/*@null@*/ /*@dependent@*/
 rpmte rpmtsElement(rpmts ts, int ix)
        /*@*/;
 
@@ -829,8 +831,8 @@ int rpmtsSetNotifyCallback(rpmts ts,
  */
 /*@newref@*/
 rpmts rpmtsCreate(void)
-       /*@globals rpmGlobalMacroContext @*/
-       /*@modifies rpmGlobalMacroContext @*/;
+       /*@globals rpmGlobalMacroContext, internalState @*/
+       /*@modifies rpmGlobalMacroContext, internalState @*/;
 
 /** \ingroup rpmts
  * Add package to be installed to transaction set.
index 0c8129d..41ceba2 100644 (file)
@@ -864,7 +864,7 @@ static void skipFiles(const rpmts ts, rpmfi fi)
        /*
         * Skip i18n language specific files.
         */
-       if (fi->flangs && languages && *fi->flangs[i]) {
+       if (languages != NULL && fi->flangs != NULL && *fi->flangs[i]) {
            const char **lang, *l, *le;
            for (lang = languages; *lang != NULL; lang++) {
                if (!strcmp(*lang, "all"))
@@ -957,11 +957,13 @@ static void skipFiles(const rpmts ts, rpmfi fi)
        }
     }
 
+/*@-dependenttrans@*/
     if (netsharedPaths) freeSplitString(netsharedPaths);
 #ifdef DYING   /* XXX freeFi will deal with this later. */
     fi->flangs = _free(fi->flangs);
 #endif
     if (languages) freeSplitString((char **)languages);
+/*@=dependenttrans@*/
 }
 /*@=bounds@*/
 /*@=mustmod@*/
@@ -1464,6 +1466,7 @@ ts->ms_repackage += rpmswDiff(rpmswNow(&ts->end), &ts->begin)/1000;
            continue;   /* XXX can't happen */
        
        psm = rpmpsmNew(ts, p, fi);
+assert(psm != NULL);
        psm->unorderedSuccessor =
                (rpmtsiOc(pi) >= rpmtsUnorderedSuccessors(ts, -1) ? 1 : 0);
 
@@ -1524,7 +1527,9 @@ ts->ms_repackage += rpmswDiff(rpmswNow(&ts->end), &ts->begin)/1000;
 
                    fi->fstates = NULL;
                    fi->actions = NULL;
+/*@-nullstate@*/ /* FIX: fi->actions is NULL */
                    fi = rpmfiFree(fi);
+/*@=nullstate@*/
 
                    savep = rpmtsSetRelocateElement(ts, p);
                    fi = rpmfiNew(ts, p->h, RPMTAG_BASENAMES, 1);
index 29c0cfd..36af08c 100644 (file)
@@ -224,6 +224,9 @@ static int rpmVerifyScript(/*@unused@*/ QVA_t qva, rpmts ts,
     rpmpsm psm = rpmpsmNew(ts, NULL, fi);
     int rc = 0;
 
+    if (psm == NULL)   /* XXX can't happen */
+       return rc;
+
     if (scriptFd != NULL)
        rpmtsSetScriptFd(psm->ts, scriptFd);
 
index b587324..1cca844 100644 (file)
@@ -35,7 +35,8 @@ struct DIGEST_CTX_s {
 DIGEST_CTX
 rpmDigestDup(DIGEST_CTX octx)
 {
-    DIGEST_CTX nctx = memcpy(xcalloc(1, sizeof(*nctx)), octx, sizeof(*nctx));
+    DIGEST_CTX nctx;
+    nctx = memcpy(xcalloc(1, sizeof(*nctx)), octx, sizeof(*nctx));
     nctx->param = memcpy(xcalloc(1, nctx->paramlen), octx->param, nctx->paramlen);
     return nctx;
 }
@@ -98,6 +99,9 @@ DPRINTF((stderr, "*** Init(%x) ctx %p param %p\n", flags, ctx, ctx->param));
 int
 rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
 {
+    if (ctx == NULL)
+       return -1;
+
 DPRINTF((stderr, "*** Update(%p,%p,%d) param %p \"%s\"\n", ctx, data, len, ctx->param, ((char *)data)));
 /*@-boundsread@*/
     return (*ctx->Update) (ctx->param, data, len);
@@ -119,13 +123,16 @@ static union _dendian {
 
 /*@-boundswrite@*/
 int
-rpmDigestFinal(/*@only@*/ DIGEST_CTX ctx, /*@out@*/ void ** datap,
-       /*@out@*/ size_t *lenp, int asAscii)
+rpmDigestFinal(DIGEST_CTX ctx, void ** datap, size_t *lenp, int asAscii)
 {
-    uint32 * digest = xmalloc(ctx->digestlen);
+    uint32 * digest;
     char * t;
     int i;
 
+    if (ctx == NULL)
+       return -1;
+    digest = xmalloc(ctx->digestlen);
+
 DPRINTF((stderr, "*** Final(%p,%p,%p,%d) param %p digest %p\n", ctx, datap, lenp, asAscii, ctx->param, digest));
     /*@-noeffectuncon@*/ /* FIX: check rc */
     (void) (*ctx->Digest) (ctx->param, digest);
index f11c17c..85ecbf8 100644 (file)
@@ -299,6 +299,9 @@ Fts_close(FTS * sp)
        register FTSENT *freep, *p;
        int saved_errno;
 
+       if (sp == NULL)
+               return 0;
+
        /*
         * This still works if we haven't read anything -- the dummy structure
         * points to the root list, so we step through to the end of the root
@@ -361,7 +364,7 @@ Fts_read(FTS * sp)
        int saved_errno;
 
        /* If finished or unrecoverable error, return NULL. */
-       if (sp->fts_cur == NULL || ISSET(FTS_STOP))
+       if (sp == NULL || sp->fts_cur == NULL || ISSET(FTS_STOP))
                return (NULL);
 
        /* Set current node pointer. */
index 487eb7d..ff9c613 100644 (file)
@@ -185,7 +185,7 @@ FTSENT      *Fts_children (FTS * sp, int instr) __THROW
  * @param sp           file hierarchy state
  * @return             0 on sucess, -1 on error
  */
-int     Fts_close (/*@only@*/ FTS * sp) __THROW
+int     Fts_close (/*@only@*/ /*@null@*/ FTS * sp) __THROW
        /*@globals fileSystem, internalState @*/
        /*@modifies *sp, fileSystem, internalState @*/;
 
@@ -208,7 +208,7 @@ FTS *Fts_open (char * const * argv, int options,
  * @return             file set member
  */
 /*@null@*/
-FTSENT *Fts_read (FTS * sp) __THROW
+FTSENT *Fts_read (/*@null@*/ FTS * sp) __THROW
        /*@globals fileSystem, internalState @*/
        /*@modifies *sp, fileSystem, internalState @*/;
 
index 4256021..64eebd5 100644 (file)
@@ -356,6 +356,7 @@ void fdPush(FD_t fd, FDIO_t io, void * fp, int fdno)
 
 /** \ingroup rpmio
  */
+/*@-uniondef@*/
 /*@unused@*/ static inline
 void fdstat_enter(/*@null@*/ FD_t fd, int opx)
        /*@globals internalState @*/
@@ -396,6 +397,7 @@ void fdstat_exit(/*@null@*/ FD_t fd, int opx, ssize_t rc)
     fd->stats->begin = end;    /* structure assignment */
 /*@=boundswrite@*/
 }
+/*@=uniondef@*/
 
 /** \ingroup rpmio
  */
index f406101..b3102e0 100644 (file)
@@ -1378,7 +1378,7 @@ DIGEST_CTX rpmDigestInit(pgpHashAlgo hashalgo, rpmDigestFlags flags)
  * @param len          no. bytes of data
  * @return             0 on success
  */
-int rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
+int rpmDigestUpdate(/*@null@*/ DIGEST_CTX ctx, const void * data, size_t len)
        /*@modifies ctx @*/;
 
 /** \ingroup rpmio
@@ -1392,7 +1392,7 @@ int rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
  * @param asAscii      return digest as ascii string?
  * @return             0 on success
  */
-int rpmDigestFinal(/*@only@*/ DIGEST_CTX ctx,
+int rpmDigestFinal(/*@only@*/ /*@null@*/ DIGEST_CTX ctx,
        /*@null@*/ /*@out@*/ void ** datap,
        /*@null@*/ /*@out@*/ size_t * lenp, int asAscii)
                /*@modifies *datap, *lenp @*/;
index a27c84b..fe58d09 100644 (file)
@@ -1,13 +1,32 @@
+/*@-unrecog@*/
 /** \ingroup rpmio
  * \file rpmio/rpmsq.c
  */
 
 #include "system.h"
-                                                                                
+
+#if defined(__LCLINT__)
+struct qelem;
+/*@-exportheader@*/
+extern void insque(struct qelem * __elem, struct qelem * __prev)
+       /*@modifies  __elem, prev @*/;
+extern void remque(struct qelem * __elem)
+       /*@modifies  __elem @*/;
+/*@=exportheader@*/
+#endif
+
+#include <signal.h>
+#include <sys/signal.h>
+#include <sys/wait.h>
+#include <search.h>
+
 #if defined(HAVE_PTHREAD_H) && !defined(__LCLINT__)
 
 #include <pthread.h>
 
+/*@unchecked@*/
+static pthread_mutex_t rpmsigTbl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+
 #define        DO_LOCK()       pthread_mutex_lock(&rpmsigTbl_lock);
 #define        DO_UNLOCK()     pthread_mutex_unlock(&rpmsigTbl_lock);
 #define        INIT_LOCK()     \
 #define        DO_LOCK()
 #define        DO_UNLOCK()
 #define        INIT_LOCK()
-#define        ADD_REF(__tbl)
-#define        SUB_REF(__tbl)
+#define        ADD_REF(__tbl)  /*@-noeffect@*/ (0) /*@=noeffect@*/
+#define        SUB_REF(__tbl)  /*@-noeffect@*/ (0) /*@=noeffect@*/
 #define        CLEANUP_HANDLER(__handler, __arg, __oldtypeptr)
 #define        CLEANUP_RESET(__execute, __oldtype)
 
 #define        SAME_THREAD(_a, _b)     (42)
 
-#define        ME()    (((void *))getpid())
+#define        ME()    (((void *)getpid()))
 
 #endif /* HAVE_PTHREAD_H */
 
@@ -57,10 +76,14 @@ int _rpmsq_debug = _RPMSQ_DEBUG;
 
 /*@unchecked@*/
 static struct rpmsqElem rpmsqRock;
+
+/*@-compmempass@*/
 /*@unchecked@*/
 rpmsq rpmsqQueue = &rpmsqRock;
+/*@=compmempass@*/
 
-int rpmsqInsert(void * elem, void * prev)
+/*@-mustmod@*/
+int rpmsqInsert(void * elem, /*@unused@*/ void * prev)
 {
     rpmsq sq = (rpmsq) elem;
     int ret = -1;
@@ -78,17 +101,24 @@ fprintf(stderr, "    Insert(%p): %p\n", ME(), sq);
            sq->reaped = 0;
            sq->status = 0;
            sq->reaper = 1;
+/*@-bounds@*/
            sq->pipes[0] = sq->pipes[1] = -1;
+/*@=bounds@*/
 
+/*@-unqualifiedtrans@*/
            sq->id = ME();
+/*@=unqualifiedtrans@*/
            ret = pthread_mutex_init(&sq->mutex, NULL);
            ret = pthread_cond_init(&sq->cond, NULL);
+#if !defined(__LCLINT__)       /* XXX FIXME */
            insque(elem, (prev ? prev : rpmsqQueue));
+#endif
            ret = sigrelse(SIGCHLD);
        }
     }
     return ret;
 }
+/*@=mustmod@*/
 
 int rpmsqRemove(void * elem)
 {
@@ -109,9 +139,11 @@ fprintf(stderr, "    Remove(%p): %p\n", ME(), sq);
            ret = pthread_cond_destroy(&sq->cond);
            ret = pthread_mutex_destroy(&sq->mutex);
            sq->id = NULL;
-           if (sq->pipes[1])   close(sq->pipes[1]);
-           if (sq->pipes[0])   close(sq->pipes[0]);
+/*@-bounds@*/
+           if (sq->pipes[1])   ret = close(sq->pipes[1]);
+           if (sq->pipes[0])   ret = close(sq->pipes[0]);
            sq->pipes[0] = sq->pipes[1] = -1;
+/*@=bounds@*/
 #ifdef NOTYET  /* rpmpsmWait debugging message needs */
            sq->reaper = 1;
            sq->status = 0;
@@ -128,13 +160,10 @@ fprintf(stderr, "    Remove(%p): %p\n", ME(), sq);
 sigset_t rpmsqCaught;
 
 /*@unchecked@*/
-static pthread_mutex_t rpmsigTbl_lock = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
-
-/*@unchecked@*/
 /*@-fullinitblock@*/
 static struct rpmsig_s {
     int signum;
-    void (*handler) (int signum, siginfo_t * info, void * context);
+    void (*handler) (int signum, void * info, void * context);
     int active;
     struct sigaction oact;
 } rpmsigTbl[] = {
@@ -155,7 +184,10 @@ static struct rpmsig_s {
 /*@=fullinitblock@*/
 
 /*@-incondefs@*/
-void rpmsqAction(int signum, siginfo_t * info, void * context)
+void rpmsqAction(int signum,
+               /*@unused@*/ void * info, /*@unused@*/ void * context)
+       /*@globals rpmsqQueue @*/
+       /*@modifies rpmsqQueue @*/
 {
     int save = errno;
     rpmsig tbl;
@@ -186,7 +218,9 @@ void rpmsqAction(int signum, siginfo_t * info, void * context)
                        /*@innercontinue@*/ continue;
                    sq->reaped = reaped;
                    sq->status = status;
+#if defined(HAVE_PTHREAD_H) && !defined(__LCLINT__)
                    (void) pthread_cond_signal(&sq->cond);
+#endif
                    /*@innerbreak@*/ break;
                }
            }
@@ -201,6 +235,8 @@ void rpmsqAction(int signum, siginfo_t * info, void * context)
 /*@=incondefs@*/
 
 int rpmsqEnable(int signum, /*@null@*/ rpmsqAction_t handler)
+       /*@globals rpmsigTbl @*/
+       /*@modifies rpmsigTbl @*/
 {
     int tblsignum = (signum >= 0 ? signum : -signum);
     struct sigaction sa;
@@ -208,8 +244,10 @@ int rpmsqEnable(int signum, /*@null@*/ rpmsqAction_t handler)
     int ret = -1;
 
     DO_LOCK ();
+#if !defined(__LCLINT__)
     if (rpmsqQueue->id == NULL)
        rpmsqQueue->id = ME();
+#endif
     for (tbl = rpmsigTbl; tbl->signum >= 0; tbl++) {
        if (tblsignum != tbl->signum)
            continue;
@@ -217,13 +255,15 @@ int rpmsqEnable(int signum, /*@null@*/ rpmsqAction_t handler)
        if (signum >= 0) {                      /* Enable. */
            if (ADD_REF(tbl) <= 0) {
                (void) sigdelset(&rpmsqCaught, tbl->signum);
-               sigemptyset (&sa.sa_mask);
+               (void) sigemptyset (&sa.sa_mask);
+/*@-compdef -type @*/
                sa.sa_flags = SA_SIGINFO;
                sa.sa_sigaction = (handler != NULL ? handler : tbl->handler);
                if (sigaction(tbl->signum, &sa, &tbl->oact) < 0) {
                    SUB_REF(tbl);
                    break;
                }
+/*@=compdef =type @*/
                tbl->active = 1;                /* XXX just in case */
                if (handler != NULL)
                    tbl->handler = handler;
@@ -265,18 +305,22 @@ fprintf(stderr, "    Enable(%p): %p\n", ME(), sq);
 
     pid = fork();
     if (pid < (pid_t) 0) {             /* fork failed.  */
+/*@-bounds@*/
        xx = close(sq->pipes[0]);
        xx = close(sq->pipes[1]);
        sq->pipes[0] = sq->pipes[1] = -1;
+/*@=bounds@*/
        goto out;
     } else if (pid == (pid_t) 0) {     /* Child. */
        int yy;
 
        /* Block to permit parent to wait. */
+/*@-bounds@*/
        xx = close(sq->pipes[1]);
        xx = read(sq->pipes[0], &yy, sizeof(yy));
        xx = close(sq->pipes[0]);
        sq->pipes[0] = sq->pipes[1] = -1;
+/*@=bounds@*/
 
 #ifdef _RPMSQ_DEBUG
 /*@-modfilesys@*/
@@ -297,10 +341,12 @@ fprintf(stderr, "    Parent(%p): %p child %d\n", ME(), sq, sq->child);
 #endif
 
 #ifdef DYING
+/*@-bounds@*/
        /* Unblock child. */
        xx = close(sq->pipes[0]);
        xx = close(sq->pipes[1]);
        sq->pipes[0] = sq->pipes[1] = -1;
+/*@=bounds@*/
 #endif
 
     }
@@ -317,7 +363,7 @@ out:
  */
 static int rpmsqWaitUnregister(rpmsq sq)
        /*@globals fileSystem, internalState @*/
-       /*@modifies fileSystem, internalState @*/
+       /*@modifies sq, fileSystem, internalState @*/
 {
     struct rpmsw_s end;
     int same_thread = 0;
@@ -330,11 +376,13 @@ static int rpmsqWaitUnregister(rpmsq sq)
        ret = pthread_mutex_lock(&sq->mutex);
 
     /* Start the child. */
+/*@-bounds@*/
     if (sq->pipes[0] >= 0)
        xx = close(sq->pipes[0]);
     if (sq->pipes[1] >= 0)
        xx = close(sq->pipes[1]);
     sq->pipes[0] = sq->pipes[1] = -1;
+/*@=bounds@*/
 
     (void) rpmswNow(&sq->begin);
 
@@ -347,7 +395,9 @@ static int rpmsqWaitUnregister(rpmsq sq)
     }
     /*@=infloops@*/
 
+/*@-uniondef@*/
     sq->msecs = rpmswDiff(rpmswNow(&end), &sq->begin)/1000;
+/*@=uniondef@*/
     sq->script_msecs += sq->msecs;
 
     if (same_thread)
@@ -432,6 +482,8 @@ fprintf(stderr, "    Thread(%p): %p\n", ME(), pth);
  */
 static void
 sigchld_cancel (void *arg)
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fileSystem, internalState @*/
 {
     pid_t child = *(pid_t *) arg;
     pid_t result;
@@ -453,6 +505,7 @@ sigchld_cancel (void *arg)
 /**
  * Execute a command, returning its status.
  */
+/*@-bounds@*/
 int
 rpmsqExecve (const char ** argv)
 {
@@ -476,8 +529,8 @@ rpmsqExecve (const char ** argv)
     }
     DO_UNLOCK ();
 
-    sigemptyset (&newMask);
-    sigaddset (&newMask, SIGCHLD);
+    (void) sigemptyset (&newMask);
+    (void) sigaddset (&newMask, SIGCHLD);
     if (sigprocmask (SIG_BLOCK, &newMask, &oldMask) < 0) {
        DO_LOCK ();
        if (SUB_REF (rpmsigTbl_sigchld) == 0)
@@ -529,3 +582,5 @@ out:
     DO_UNLOCK ();
     return status;
 }
+/*@=bounds@*/
+/*@=unrecog@*/
index 04fcf5e..6d80f78 100644 (file)
@@ -6,18 +6,23 @@
  *
  */
 
-#include <pthread.h>
-#include <signal.h>
-#include <sys/signal.h>
-#include <search.h>            /* XXX insque(3)/remque(3) protos. */
-
 #include <rpmsw.h>
 
+/**
+ */
 typedef struct rpmsig_s * rpmsig;
 
+/**
+ */
 typedef struct rpmsqElem * rpmsq;
 
-typedef void (*rpmsqAction_t) (int signum, siginfo_t *info, void *context)
+/**
+ * Default signal handler prototype.
+ * @param signum       signal number
+ * @param info         (siginfo_t) signal info
+ * @param context      signal context
+ */
+typedef void (*rpmsqAction_t) (int signum, void * info, void * context)
        /*@*/;
 
 /*@-redecl@*/
@@ -44,8 +49,10 @@ struct rpmsqElem {
     pthread_cond_t cond;
 };
 
+/*@-exportlocal@*/
 /*@unchecked@*/
 extern rpmsq rpmsqQueue;
+/*@=exportlocal@*/
 
 /*@unchecked@*/
 extern sigset_t rpmsqCaught;
@@ -55,21 +62,38 @@ extern sigset_t rpmsqCaught;
 #endif
 
 /**
+ * Insert node into from queue.
+ * @param elem         node to link
+ * @param prev         previous node from queue
+ * @return             0 on success
  */
+/*@-exportlocal@*/
 int rpmsqInsert(/*@null@*/ void * elem, /*@null@*/ void * prev)
-       /*@globals rpmsqQueue @*/
-       /*@modifies elem, rpmsqQueue @*/;
+       /*@modifies elem @*/;
+/*@=exportlocal@*/
 
 /**
+ * Remove node from queue.
+ * @param elem         node to link
+ * @return             0 on success
  */
+/*@-exportlocal@*/
 int rpmsqRemove(/*@null@*/ void * elem)
-       /*@modifies elem @*/;
+       /*@globals fileSystem, internalState @*/
+       /*@modifies elem, fileSystem, internalState @*/;
+/*@=exportlocal@*/
 
 /**
+ * Default signal handler.
+ * @param signum       signal number
+ * @param info         (siginfo_t) signal info
+ * @param context      signal context
  */
-void rpmsqAction(int signum, siginfo_t * info, void * context)
-       /*@globals rpmsqCaught, fileSystem @*/
-       /*@modifies rpmsqCaught, fileSystem @*/;
+/*@-exportlocal@*/
+void rpmsqAction(int signum, void * info, void * context)
+       /*@globals rpmsqCaught, errno, fileSystem @*/
+       /*@modifies rpmsqCaught, errno, fileSystem @*/;
+/*@=exportlocal@*/
 
 /**
  * Enable or disable a signal handler.
@@ -106,14 +130,15 @@ pid_t rpmsqWait(rpmsq sq)
  * @return             0 on success
  */
 int rpmsqThread(void * (*start) (void * arg), void * arg)
-       /*@globals fileSystem, internalState @*/
-       /*@modifies fileSystem, internalState @*/;
+       /*@globals internalState @*/
+       /*@modifies internalState @*/;
 
 /**
  * Execute a command, returning its status.
  */
 int rpmsqExecve (const char ** argv)
-       /*@*/;
+       /*@globals fileSystem, internalState @*/
+       /*@modifies fileSystem, internalState @*/;
 
 #ifdef __cplusplus
 }
index 6c6d9af..4d521de 100644 (file)
@@ -8,8 +8,10 @@
 
 #if defined(__LCLINT__)
 /*@-exportheader@*/
-extern int nanosleep(const struct timespec *req, /*@out@*/ struct timespec *rem)
-       /*@modifies rem @*/;
+extern int nanosleep(const struct timespec *__requested_time,
+               /*@out@*/ /*@null@*/ struct timespec *__remaining)
+       /*@globals errno @*/
+       /*@modifies *__remaining, errno @*/;
 /*@=exportheader@*/
 #endif
 
@@ -153,7 +155,9 @@ static rpmtime_t rpmswCalibrate(void)
     int rc;
     int i;
 
+/*@-uniondef@*/
     (void) rpmswNow(&begin);
+/*@=uniondef@*/
     req.tv_sec = 0;
     req.tv_nsec = 20 * 1000 * 1000;
     for (i = 0; i < 100; i++) {
@@ -166,7 +170,9 @@ static rpmtime_t rpmswCalibrate(void)
            break;
        req = rem;      /* structure assignment */
     }
+/*@-uniondef@*/
     ticks = rpmswDiff(rpmswNow(&end), &begin);
+/*@=uniondef@*/
 
     return ticks;
 }
@@ -199,7 +205,9 @@ rpmtime_t rpmswInit(void)
 
        /* Start wall clock. */
        rpmsw_type = 0;
+/*@-uniondef@*/
        (void) rpmswNow(&begin);
+/*@=uniondef@*/
 
        /* Get no. of cycles in 20ms nanosleep */
        rpmsw_type = 1;
@@ -209,7 +217,9 @@ rpmtime_t rpmswInit(void)
 
        /* Compute wall clock delta in usecs. */
        rpmsw_type = 0;
+/*@-uniondef@*/
        usecs = rpmswDiff(rpmswNow(&end), &begin);
+/*@=uniondef@*/
 
        rpmsw_type = 1;
 
@@ -224,8 +234,10 @@ rpmtime_t rpmswInit(void)
 #endif
 
        /* Calculate timing overhead in usecs. */
+/*@-uniondef@*/
        (void) rpmswNow(&begin);
        usecs = rpmswDiff(rpmswNow(&end), &begin);
+/*@=uniondef@*/
 
        rpmsw_overhead *= i;
        rpmsw_overhead += usecs;
@@ -241,7 +253,9 @@ rpmtime_t rpmswInit(void)
 int rpmswEnter(rpmop op)
 {
     op->count++;
+/*@-uniondef@*/
     (void) rpmswNow(&op->begin);
+/*@=uniondef@*/
     return 0;
 }
 
@@ -249,7 +263,9 @@ int rpmswExit(rpmop op, ssize_t rc)
 {
     struct rpmsw_s end;
 
+/*@-uniondef@*/
     op->usecs += rpmswDiff(rpmswNow(&end), &op->begin);
+/*@=uniondef@*/
     if (rc > 0)
        op->bytes += rc;
     return 0;
index 91f9d9c..48bcf1b 100644 (file)
@@ -61,9 +61,11 @@ rpmtime_t rpmswDiff(/*@null@*/ rpmsw end, /*@null@*/ rpmsw begin)
 /** Return benchmark time stamp overhead.
  * @return             overhead in micro-seconds
  */
+/*@-exportlocal@*/
 rpmtime_t rpmswInit(void)
        /*@globals internalState @*/
        /*@modifes internalState @*/;
+/*@=exportlocal@*/
 
 /** \ingroup rpmio
  * Enter timed operation.