diff options
-rw-r--r-- | build.c | 29 | ||||
-rw-r--r-- | build.h | 6 | ||||
-rw-r--r-- | rpm2cpio.c | 3 | ||||
-rw-r--r-- | rpmqv.c | 72 | ||||
-rw-r--r-- | system.h | 44 |
5 files changed, 36 insertions, 118 deletions
@@ -14,15 +14,9 @@ #include "build.h" #include "debug.h" -/*@access rpmts @*/ /* XXX compared with NULL @*/ -/*@access rpmdb @*/ /* XXX compared with NULL @*/ -/*@access FD_t @*/ /* XXX compared with NULL @*/ - /** */ static int checkSpec(rpmts ts, Header h) - /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ - /*@modifies ts, h, rpmGlobalMacroContext, fileSystem, internalState @*/ { rpmps ps; int rc; @@ -57,8 +51,6 @@ static int checkSpec(rpmts ts, Header h) /** */ static int isSpecFile(const char * specfile) - /*@globals h_errno, fileSystem, internalState @*/ - /*@modifies fileSystem, internalState @*/ { char buf[256]; const char * s; @@ -81,20 +73,18 @@ static int isSpecFile(const char * specfile) case '\r': case '\n': checking = 1; - /*@switchbreak@*/ break; + break; case ':': checking = 0; - /*@switchbreak@*/ break; -/*@-boundsread@*/ + break; default: #if 0 if (checking && !(isprint(*s) || isspace(*s))) return 0; - /*@switchbreak@*/ break; + break; #else if (checking && !(isprint(*s) || isspace(*s)) && *(unsigned char *)s < 32) return 0; - /*@switchbreak@*/ break; + break; #endif -/*@=boundsread@*/ } } return 1; @@ -102,10 +92,7 @@ static int isSpecFile(const char * specfile) /** */ -/*@-boundswrite@*/ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) - /*@globals rpmGlobalMacroContext, h_errno, fileSystem, internalState @*/ - /*@modifies ts, rpmGlobalMacroContext, fileSystem, internalState @*/ { const char * passPhrase = ba->passPhrase; const char * cookie = ba->cookie; @@ -122,19 +109,17 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS); #endif - /*@-branchstate@*/ if (ba->buildRootOverride) buildRootURL = rpmGenPath(NULL, ba->buildRootOverride, NULL); - /*@=branchstate@*/ - /*@-compmempass@*/ /* FIX: static zcmds heartburn */ + /* FIX: static zcmds heartburn */ if (ba->buildMode == 't') { FILE *fp; const char * specDir; char * tmpSpecFile; char * cmd, * s; rpmCompressedMagic res = COMPRESSED_OTHER; - /*@observer@*/ static const char *zcmds[] = + static const char *zcmds[] = { "cat", "gunzip", "bunzip2", "cat" }; specDir = rpmGetPath("%{_specdir}", NULL); @@ -228,7 +213,6 @@ static int buildForTarget(rpmts ts, const char * arg, BTA_t ba) } else { specURL = arg; } - /*@=compmempass@*/ specut = urlPath(specURL, &specFile); if (*specFile != '/') { @@ -304,7 +288,6 @@ exit: buildRootURL = _free(buildRootURL); return rc; } -/*@=boundswrite@*/ int build(rpmts ts, const char * arg, BTA_t ba, const char * rcfile) { @@ -6,11 +6,7 @@ extern "C" { #endif int build(rpmts ts, const char * arg, BTA_t ba, - /*@null@*/ const char * rcfile) - /*@globals rpmGlobalMacroContext, rpmCLIMacroContext, - h_errno, fileSystem, internalState @*/ - /*@modifies ts, ba->buildAmount, rpmGlobalMacroContext, rpmCLIMacroContext, - fileSystem, internalState @*/; + const char * rcfile); #ifdef __cplusplus } diff --git a/rpm2cpio.c b/rpm2cpio.c index 06e389a09..3ef741d81 100644 --- a/rpm2cpio.c +++ b/rpm2cpio.c @@ -40,9 +40,8 @@ int main(int argc, char **argv) vsflags |= RPMVSF_NOHDRCHK; (void) rpmtsSetVSFlags(ts, vsflags); - /*@-mustmod@*/ /* LCL: segfault */ + /* LCL: segfault */ rc = rpmReadPackageFile(ts, fdi, "rpm2cpio", &h); - /*@=mustmod@*/ ts = rpmtsFree(ts); } @@ -65,7 +65,6 @@ enum modes { #define MODES_FOR_ROOT (MODES_BT | MODES_IE | MODES_QV | MODES_DB | MODES_K) /* the structure describing the options we take and the defaults */ -/*@unchecked@*/ static struct poptOption optionsTable[] = { #ifdef IAM_RPMQV @@ -123,32 +122,24 @@ static struct poptOption optionsTable[] = { long _stksize = 64 * 1024L; #endif -/*@exits@*/ static void argerror(const char * desc) - /*@globals __assert_program_name, fileSystem @*/ - /*@modifies fileSystem @*/ +static void argerror(const char * desc) { fprintf(stderr, _("%s: %s\n"), __progname, desc); exit(EXIT_FAILURE); } static void printVersion(FILE * fp) - /*@globals rpmEVR, fileSystem @*/ - /*@modifies *fp, fileSystem @*/ { fprintf(fp, _("RPM version %s\n"), rpmEVR); } static void printBanner(FILE * fp) - /*@globals fileSystem @*/ - /*@modifies *fp, fileSystem @*/ { fprintf(fp, _("Copyright (C) 1998-2002 - Red Hat, Inc.\n")); fprintf(fp, _("This program may be freely redistributed under the terms of the GNU GPL\n")); } static void printUsage(poptContext con, FILE * fp, int flags) - /*@globals rpmEVR, fileSystem, internalState @*/ - /*@modifies *fp, fileSystem, internalState @*/ { printVersion(fp); printBanner(fp); @@ -160,18 +151,13 @@ static void printUsage(poptContext con, FILE * fp, int flags) poptPrintUsage(con, fp, flags); } -/*@-bounds@*/ /* LCL: segfault */ -/*@-mods@*/ /* FIX: shrug */ +/* LCL: segfault */ +/* FIX: shrug */ #if !defined(__GLIBC__) -int main(int argc, const char ** argv, /*@unused@*/ char ** envp) +int main(int argc, const char ** argv, char ** envp) #else int main(int argc, const char ** argv) #endif - /*@globals __assert_program_name, rpmEVR, RPMVERSION, - rpmGlobalMacroContext, rpmCLIMacroContext, - h_errno, fileSystem, internalState@*/ - /*@modifies __assert_program_name, - fileSystem, internalState@*/ { rpmts ts = NULL; enum modes bigMode = MODE_UNKNOWN; @@ -213,9 +199,7 @@ int main(int argc, const char ** argv) #endif #if HAVE_MCHECK_H && HAVE_MTRACE - /*@-noeffect@*/ mtrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */ - /*@=noeffect@*/ #endif setprogname(argv[0]); /* Retrofit glibc __progname */ @@ -230,7 +214,6 @@ int main(int argc, const char ** argv) } /* Set the major mode based on argv[0] */ - /*@-nullpass@*/ #ifdef IAM_RPMBT if (!strcmp(__progname, "rpmb")) bigMode = MODE_BUILD; if (!strcmp(__progname, "lt-rpmb")) bigMode = MODE_BUILD; @@ -250,7 +233,6 @@ int main(int argc, const char ** argv) if (!strcmp(__progname, "lt-rpmi")) bigMode = MODE_INSTALL; if (!strcmp(__progname, "rpmu")) bigMode = MODE_INSTALL; #endif - /*@=nullpass@*/ #if defined(IAM_RPMQV) /* Jumpstart option from argv[0] if necessary. */ @@ -286,9 +268,7 @@ int main(int argc, const char ** argv) /* Make a first pass through the arguments, looking for --rcfile */ /* We need to handle that before dealing with the rest of the arguments. */ - /*@-nullpass -temptrans@*/ optCon = poptGetContext(__progname, argc, argv, optionsTable, 0); - /*@=nullpass =temptrans@*/ (void) poptReadConfigFile(optCon, LIBRPMALIAS_FILENAME); (void) poptReadDefaultConfig(optCon, 1); poptSetExecPath(optCon, RPMCONFIGDIR, 1); @@ -513,7 +493,6 @@ int main(int argc, const char ** argv) default: if (bigMode & MODES_FOR_ROOT) break; - /*@fallthrough@*/ case URL_IS_UNKNOWN: if (rpmcliRootDir[0] != '/') argerror(_("arguments to --root (-r) must begin with a /")); @@ -530,7 +509,6 @@ int main(int argc, const char ** argv) || ka->sign #endif ) - /*@-branchstate@*/ { if (bigMode == MODE_REBUILD || bigMode == MODE_BUILD || bigMode == MODE_RESIGN || bigMode == MODE_TARBUILD) @@ -568,7 +546,7 @@ int main(int argc, const char ** argv) fprintf(stderr, _("pgp not found: ")); ec = EXIT_FAILURE; goto exit; - } /*@fallthrough@*/ + } #endif case RPMSIGTAG_GPG: case RPMSIGTAG_DSA: @@ -587,7 +565,7 @@ int main(int argc, const char ** argv) _("Invalid %%_signature spec in macro file.\n")); ec = EXIT_FAILURE; goto exit; - /*@notreached@*/ break; + break; } } } else { @@ -597,7 +575,6 @@ int main(int argc, const char ** argv) /* Make rpmLookupSignatureType() return 0 ("none") from now on */ (void) rpmLookupSignatureType(RPMLOOKUPSIG_DISABLE); } - /*@=branchstate@*/ #endif /* IAM_RPMBT || IAM_RPMK */ if (rpmcliPipeOutput) { @@ -670,7 +647,7 @@ int main(int argc, const char ** argv) specFile = _free(specFile); if (ec) - /*@loopbreak@*/ break; + break; } } break; @@ -684,32 +661,28 @@ int main(int argc, const char ** argv) switch (ba->buildChar) { case 'a': ba->buildAmount |= RPMBUILD_PACKAGESOURCE; - /*@fallthrough@*/ case 'b': ba->buildAmount |= RPMBUILD_PACKAGEBINARY; ba->buildAmount |= RPMBUILD_CLEAN; - /*@fallthrough@*/ case 'i': ba->buildAmount |= RPMBUILD_INSTALL; ba->buildAmount |= RPMBUILD_CHECK; if ((ba->buildChar == 'i') && ba->shortCircuit) - /*@innerbreak@*/ break; - /*@fallthrough@*/ + break; case 'c': ba->buildAmount |= RPMBUILD_BUILD; if ((ba->buildChar == 'c') && ba->shortCircuit) - /*@innerbreak@*/ break; - /*@fallthrough@*/ + break; case 'p': ba->buildAmount |= RPMBUILD_PREP; - /*@innerbreak@*/ break; + break; case 'l': ba->buildAmount |= RPMBUILD_FILECHECK; - /*@innerbreak@*/ break; + break; case 's': ba->buildAmount |= RPMBUILD_PACKAGESOURCE; - /*@innerbreak@*/ break; + break; } if (!poptPeekArg(optCon)) { @@ -725,7 +698,7 @@ int main(int argc, const char ** argv) ba->cookie = NULL; ec = build(ts, pkg, ba, rpmcliRcfile); if (ec) - /*@loopbreak@*/ break; + break; rpmFreeMacros(NULL); (void) rpmReadConfigFiles(rpmcliRcfile, NULL); } @@ -761,7 +734,6 @@ ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE; if (ia->noDeps) ia->installInterfaceFlags |= INSTALL_NODEPS; /* we've already ensured !(!ia->prefix && !ia->relocations) */ - /*@-branchstate@*/ if (ia->prefix) { ia->relocations = xmalloc(2 * sizeof(*ia->relocations)); ia->relocations[0].oldPath = NULL; /* special case magic */ @@ -774,18 +746,16 @@ ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE; ia->relocations[ia->numRelocations].oldPath = NULL; ia->relocations[ia->numRelocations].newPath = NULL; } - /*@=branchstate@*/ if (!poptPeekArg(optCon)) { if (ia->rbtid == 0) argerror(_("no packages given for install")); ia->transFlags |= RPMTRANS_FLAG_NOMD5; ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE; -/*@i@*/ ec += rpmRollback(ts, ia, NULL); + ec += rpmRollback(ts, ia, NULL); } else { - /*@-compdef -compmempass@*/ /* FIX: ia->relocations[0].newPath undefined */ + /* FIX: ia->relocations[0].newPath undefined */ ec += rpmInstall(ts, ia, (const char **)poptGetArgs(optCon)); - /*@=compdef =compmempass@*/ } break; @@ -822,7 +792,7 @@ ia->probFilter |= RPMPROB_FILTER_OLDPACKAGE; verifyFlags &= ~ka->qva_flags; ka->qva_flags = (rpmQueryFlags) verifyFlags; - } /*@fallthrough@*/ + } case MODE_RESIGN: if (!poptPeekArg(optCon)) argerror(_("no arguments given")); @@ -870,7 +840,7 @@ exit: optCon = poptFreeContext(optCon); rpmFreeMacros(NULL); -/*@i@*/ rpmFreeMacros(rpmCLIMacroContext); + rpmFreeMacros(rpmCLIMacroContext); rpmFreeRpmrc(); if (pipeChild) { @@ -880,7 +850,7 @@ exit: /* keeps memory leak checkers quiet */ freeFilesystems(); -/*@i@*/ urlFreeCache(); + urlFreeCache(); rpmlogClose(); dbiTags = _free(dbiTags); @@ -902,17 +872,11 @@ exit: #endif #if HAVE_MCHECK_H && HAVE_MTRACE - /*@-noeffect@*/ muntrace(); /* Trace malloc only if MALLOC_TRACE=mtrace-output-file. */ - /*@=noeffect@*/ #endif /* XXX don't overflow single byte exit status */ if (ec > 255) ec = 255; - /*@-globstate@*/ return ec; - /*@=globstate@*/ } -/*@=mods@*/ -/*@=bounds@*/ @@ -82,18 +82,16 @@ char *memchr (); #endif #if !defined(HAVE_STPCPY) -char * stpcpy(/*@out@*/ char * dest, const char * src); +char * stpcpy(char * dest, const char * src); #endif #if !defined(HAVE_STPNCPY) -char * stpncpy(/*@out@*/ char * dest, const char * src, size_t n); +char * stpncpy(char * dest, const char * src, size_t n); #endif #include <errno.h> #ifndef errno -/*@-declundef @*/ extern int errno; -/*@=declundef @*/ #endif #if HAVE_ERROR && HAVE_ERROR_H @@ -105,12 +103,9 @@ extern int errno; #endif #ifdef STDC_HEADERS -/*@-macrounrecog -incondefs -globuse -mustmod @*/ /* FIX: shrug */ +/* FIX: shrug */ #define getopt system_getopt -/*@=macrounrecog =incondefs =globuse =mustmod @*/ -/*@-skipansiheaders@*/ #include <stdlib.h> -/*@=skipansiheaders@*/ #undef getopt #else /* not STDC_HEADERS */ char *getenv (const char *name); @@ -193,9 +188,7 @@ char *alloca (); #endif #if HAVE_GETOPT_H -/*@-noparams@*/ #include <getopt.h> -/*@=noparams@*/ #endif #if HAVE_GRP_H @@ -240,38 +233,28 @@ typedef char * security_context_t; #define rpm_execcon(_v, _fn, _av, _envp) (0) #endif -/*@-declundef -incondefs @*/ /* FIX: these are macros */ +/* FIX: these are macros */ /** */ -/*@mayexit@*/ /*@only@*/ /*@out@*/ void * xmalloc (size_t size) - /*@globals errno @*/ - /*@ensures maxSet(result) == (size - 1) @*/ - /*@modifies errno @*/; +void * xmalloc (size_t size); /** */ -/*@mayexit@*/ /*@only@*/ void * xcalloc (size_t nmemb, size_t size) - /*@ensures maxSet(result) == (nmemb - 1) @*/ - /*@*/; +void * xcalloc (size_t nmemb, size_t size); /** * @todo Annotate ptr with returned/out. */ -/*@mayexit@*/ /*@only@*/ void * xrealloc (/*@null@*/ /*@only@*/ void * ptr, - size_t size) - /*@ensures maxSet(result) == (size - 1) @*/ - /*@modifies *ptr @*/; +void * xrealloc (void * ptr, + size_t size); /** */ -/*@mayexit@*/ /*@only@*/ char * xstrdup (const char *str) - /*@*/; -/*@=declundef =incondefs @*/ +char * xstrdup (const char *str); /** */ -/*@unused@*/ /*@exits@*/ /*@only@*/ void * vmefail(size_t size) - /*@*/; +void * vmefail(size_t size); #if HAVE_MCHECK_H #include <mcheck.h> @@ -297,7 +280,6 @@ typedef char * security_context_t; else __progname = pn; \ } #endif -/*@unchecked@*/ extern const char *__progname; #if HAVE_NETDB_H @@ -336,21 +318,15 @@ extern const char *__progname; #if !defined(USE_GNU_GLOB) #if HAVE_FNMATCH_H -/*@-noparams@*/ #include <fnmatch.h> -/*@=noparams@*/ #endif #if HAVE_GLOB_H -/*@-noparams@*/ #include <glob.h> -/*@=noparams@*/ #endif #else -/*@-noparams@*/ #include "misc/glob.h" #include "misc/fnmatch.h" -/*@=noparams@*/ #endif #if ! HAVE_S_IFSOCK |