summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/package.c14
-rw-r--r--lib/poptALL.c42
-rw-r--r--lib/poptI.c12
-rw-r--r--lib/rpmcli.h5
-rw-r--r--lib/rpmlibprov.c2
5 files changed, 53 insertions, 22 deletions
diff --git a/lib/package.c b/lib/package.c
index ee9306867..96bee8962 100644
--- a/lib/package.c
+++ b/lib/package.c
@@ -143,8 +143,8 @@ Header headerRegenSigHeader(const Header h)
/*@unchecked@*/
static int nkeyids = 0;
-/*@unchecked@*/
-static int * keyids = NULL;
+/*@unchecked@*/ /*@only@*/ /*@null@*/
+static int * keyids;
/**
* Remember current key id.
@@ -152,8 +152,8 @@ static int * keyids = NULL;
* @return 0 if new keyid, otherwise 1
*/
static int rpmtsStashKeyid(rpmts ts)
- /*@globals keyids, nkeyids @*/
- /*@modifies keyids, nkeyids @*/
+ /*@globals nkeyids, keyids @*/
+ /*@modifies nkeyids, keyids @*/
{
struct pgpDigParams_s * sigp = NULL;
unsigned int keyid;
@@ -164,15 +164,19 @@ static int rpmtsStashKeyid(rpmts ts)
sigp = &ts->dig->signature;
keyid = pgpGrab(sigp->signid+4, 4);
+ if (keyid == 0)
+ return 0;
- if (keyids != NULL && keyid > 0)
+ if (keyids != NULL)
for (i = 0; i < nkeyids; i++) {
if (keyid == keyids[i])
return 1;
}
keyids = xrealloc(keyids, (nkeyids + 1) * sizeof(*keyids));
+/*@-boundswrite@*/
keyids[nkeyids] = keyid;
+/*@=boundswrite@*/
nkeyids++;
return 0;
diff --git a/lib/poptALL.c b/lib/poptALL.c
index 5beecdd5e..5e2f7391a 100644
--- a/lib/poptALL.c
+++ b/lib/poptALL.c
@@ -25,7 +25,7 @@ static const char * pipeOutput = NULL;
/*@unchecked@*/
/*@observer@*/ /*@null@*/
static const char * rcfile = NULL;
-/*@unchecked@*/
+/*@unchecked@*/ /*@observer@*/
static const char * rootdir = "/";
/*@-exportheadervar@*/
@@ -53,8 +53,10 @@ static void printVersion(void)
*/
/*@mayexit@*/
static void rpmcliConfigured(void)
- /*@globals internalState @*/
- /*@modifies internalState @*/
+ /*@globals rpmCLIMacroContext, rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
+ fileSystem, internalState @*/
{
static int initted = -1;
@@ -71,7 +73,10 @@ static void rpmcliAllArgCallback( /*@unused@*/ poptContext con,
/*@unused@*/ enum poptCallbackReason reason,
const struct poptOption * opt, const char * arg,
/*@unused@*/ const void * data)
- /*@*/
+ /*@globals rpmCLIMacroContext, rpmGlobalMacroContext,
+ fileSystem, internalState @*/
+ /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext,
+ fileSystem, internalState @*/
{
#if 0
/*@observer@*/
@@ -92,7 +97,9 @@ fprintf(stderr, "*** rpmcliALL: -%c,--%s %s %s opt %p arg %p val %d\n", opt->sho
case 'D':
(void) rpmDefineMacro(NULL, arg, RMIL_CMDLINE);
rpmcliConfigured();
+/*@-type@*/
(void) rpmDefineMacro(rpmCLIMacroContext, arg, RMIL_CMDLINE);
+/*@=type@*/
break;
case 'E':
rpmcliConfigured();
@@ -118,6 +125,7 @@ fprintf(stderr, "*** rpmcliALL: -%c,--%s %s %s opt %p arg %p val %d\n", opt->sho
/*@=branchstate@*/
}
+/*@-bitwisesigned -compmempass @*/
/*@unchecked@*/
struct poptOption rpmcliAllPoptTable[] = {
/*@-type@*/ /* FIX: cast? */
@@ -158,7 +166,7 @@ struct poptOption rpmcliAllPoptTable[] = {
N_("read <FILE:...> instead of default file(s)"),
N_("<FILE:...>") },
#endif
- { "showrc", '\0', 0, POPT_SHOWRC|POPT_ARGFLAG_DOC_HIDDEN, 0,
+ { "showrc", '\0', POPT_ARGFLAG_DOC_HIDDEN, 0, POPT_SHOWRC,
N_("display final rpmrc and macro configuration"),
NULL },
@@ -176,6 +184,7 @@ struct poptOption rpmcliAllPoptTable[] = {
POPT_TABLEEND
};
+/*@=bitwisesigned =compmempass @*/
poptContext
rpmcliFini(poptContext optCon)
@@ -183,12 +192,15 @@ rpmcliFini(poptContext optCon)
optCon = poptFreeContext(optCon);
#if HAVE_MCHECK_H && HAVE_MTRACE
+ /*@-noeffect@*/
muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
+ /*@=noeffect@*/
#endif
return NULL;
}
+/*@-globstate@*/
poptContext
rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
{
@@ -197,8 +209,11 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
int rc;
#if HAVE_MCHECK_H && HAVE_MTRACE
+ /*@-noeffect@*/
mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */
+ /*@=noeffect@*/
#endif
+/*@-globs -mods@*/
setprogname(argv[0]); /* Retrofit glibc __progname */
/* XXX glibc churn sanity */
@@ -206,14 +221,14 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
if ((__progname = strrchr(argv[0], '/')) != NULL) __progname++;
else __progname = argv[0];
}
+/*@=globs =mods@*/
+#if !defined(__LCLINT__)
(void)setlocale(LC_ALL, "" );
-#ifdef __LCLINT__
-#define LOCALEDIR "/usr/share/locale"
-#endif
(void)bindtextdomain(PACKAGE, LOCALEDIR);
(void)textdomain(PACKAGE);
+#endif
rpmSetVerbosity(RPMMESS_NORMAL);
@@ -223,9 +238,11 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
return NULL;
}
+/*@-nullpass -temptrans@*/
optCon = poptGetContext(__progname, argc, (const char **)argv, optionsTable, 0);
+/*@=nullpass =temptrans@*/
(void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME);
- poptReadDefaultConfig(optCon, 1);
+ (void) poptReadDefaultConfig(optCon, 1);
poptSetExecPath(optCon, RPMCONFIGDIR, 1);
/* Process all options, whine if unknown. */
@@ -233,18 +250,22 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
optArg = poptGetOptArg(optCon);
switch (rc) {
default:
+/*@-nullpass@*/
fprintf(stderr, _("%s: option table misconfigured (%d)\n"),
__progname, rc);
+/*@=nullpass@*/
exit(EXIT_FAILURE);
- /*@notreached@*/ break;
+ /*@notreached@*/ /*@switchbreak@*/ break;
}
}
if (rc < -1) {
+/*@-nullpass@*/
fprintf(stderr, "%s: %s: %s\n", __progname,
poptBadOption(optCon, POPT_BADOPTION_NOALIAS),
poptStrerror(rc));
+/*@=nullpass@*/
exit(EXIT_FAILURE);
}
@@ -258,5 +279,6 @@ rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
return optCon;
}
+/*@=globstate@*/
/*@=boundsread@*/
diff --git a/lib/poptI.c b/lib/poptI.c
index d85570ceb..13736dedb 100644
--- a/lib/poptI.c
+++ b/lib/poptI.c
@@ -51,9 +51,9 @@ static void installArgCallback( /*@unused@*/ poptContext con,
argerror(_("exclude paths must begin with a /"));
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
- /*@-temptrans@*/
+/*@-temptrans@*/
ia->relocations[ia->numRelocations].oldPath = xstrdup(arg);
- /*@=temptrans@*/
+/*@=temptrans@*/
ia->relocations[ia->numRelocations].newPath = NULL;
ia->numRelocations++;
break;
@@ -71,12 +71,12 @@ static void installArgCallback( /*@unused@*/ poptContext con,
argerror(_("relocations must have a / following the ="));
ia->relocations = xrealloc(ia->relocations,
sizeof(*ia->relocations) * (ia->numRelocations + 1));
- /*@-temptrans@*/
+/*@-temptrans@*/
ia->relocations[ia->numRelocations].oldPath = oldPath;
- /*@=temptrans@*/
- /*@-kepttrans@*/
+/*@=temptrans@*/
+/*@-kepttrans -usereleased @*/
ia->relocations[ia->numRelocations].newPath = newPath;
- /*@=kepttrans@*/
+/*@=kepttrans =usereleased @*/
ia->numRelocations++;
} break;
case POPT_ROLLBACK:
diff --git a/lib/rpmcli.h b/lib/rpmcli.h
index b48c0cc9e..ec28baba2 100644
--- a/lib/rpmcli.h
+++ b/lib/rpmcli.h
@@ -37,7 +37,10 @@ extern struct poptOption rpmcliAllPoptTable[];
/*@null@*/
poptContext
rpmcliInit(int argc, char *const argv[], struct poptOption * optionsTable)
- /*@*/;
+ /*@globals rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
+ fileSystem, internalState @*/
+ /*@modifies rpmCLIMacroContext, rpmGlobalMacroContext, stderr,
+ fileSystem, internalState @*/;
/**
* Destroy most everything needed by an rpm CLI executable context.
diff --git a/lib/rpmlibprov.c b/lib/rpmlibprov.c
index dfd48828d..2ccb338b4 100644
--- a/lib/rpmlibprov.c
+++ b/lib/rpmlibprov.c
@@ -57,8 +57,10 @@ void rpmShowRpmlibProvides(FILE * fp)
const struct rpmlibProvides_s * rlp;
for (rlp = rpmlibProvides; rlp->featureName != NULL; rlp++) {
+/*@-nullpass@*/ /* FIX: rlp->featureEVR not NULL */
rpmds pro = rpmdsSingle(RPMTAG_PROVIDENAME, rlp->featureName,
rlp->featureEVR, rlp->featureFlags);
+/*@=nullpass@*/
const char * DNEVR = rpmdsDNEVR(pro);
if (pro != NULL && DNEVR != NULL) {