-/*@-branchstate@*/
#include "system.h"
#include <stdarg.h>
rpmSetMachine(NULL, NULL); /* XXX WTFO? Why bother? */
{ const char *mfpath;
+ /*@-branchstate@*/
if ((mfpath = rpmGetVar(RPMVAR_MACROFILES)) != NULL) {
mfpath = xstrdup(mfpath);
/*@-globs@*/ /* FIX: rpmGlobalMacroContext not in <rpmlib.h> */
/*@=globs@*/
mfpath = _free(mfpath);
}
+ /*@=branchstate@*/
}
return rc;
next[nb + 1] = '\0';
}
+ /*@-branchstate@*/
while (*next != '\0') {
linenum++;
}
}
}
+ /*@=branchstate@*/
return 0;
}
char * prelid = NULL;
FD_t fd = Fopen("/etc/.relid", "r.fdio");
int gotit = 0;
+ /*@-branchstate@*/
if (fd != NULL && !Ferror(fd)) {
chptr = xcalloc(1, 256);
{ int irelid = Fread(chptr, sizeof(*chptr), 256, fd);
}
chptr = _free (chptr);
}
+ /*@=branchstate@*/
if (!gotit) /* parsing /etc/.relid file failed? */
strcpy(un.sysname,"ncr-sysv4");
/* wrong, just for now, find out how to look for i586 later*/
var->arch = _free(var->arch);
var->value = _free(var->value);
+ /*@-branchstate@*/
if (var != orig) var = _free(var);
+ /*@=branchstate@*/
var = next;
}
}
rpmSetTables(RPM_MACHTABLE_INSTARCH, RPM_MACHTABLE_INSTOS);
rpmSetTables(RPM_MACHTABLE_BUILDARCH, RPM_MACHTABLE_BUILDOS);
+ /*@-branchstate@*/
if (target && *target) {
char *c;
/* Set arch and os from specified build target */
rpmGetOsInfo(&o, NULL);
co = (o) ? xstrdup(o) : NULL;
}
+ /*@=branchstate@*/
/* If still not set, Set target arch/os from default uname(2) values */
if (ca == NULL) {
}
}
+ /*@-branchstate@*/
if (canontarget)
*canontarget = ct;
else
ct = _free(ct);
+ /*@=branchstate@*/
ca = _free(ca);
/*@-usereleased@*/
co = _free(co);
return 0;
}
-/*@=branchstate@*/
-/*@-branchstate@*/
/** \ingroup rpmtrans
* \file lib/transaction.c
*/
/* FIXME: Trailing /'s will confuse us greatly. Internal ones will
too, but those are more trouble to fix up. :-( */
t = alloca_strdup(rawRelocations[i].oldPath);
+ /*@-branchstate@*/
relocations[i].oldPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
+ /*@=branchstate@*/
/* An old path w/o a new path is valid, and indicates exclusion */
if (rawRelocations[i].newPath) {
int del;
t = alloca_strdup(rawRelocations[i].newPath);
+ /*@-branchstate@*/
relocations[i].newPath = (t[0] == '/' && t[1] == '\0')
? t
: stripTrailingChar(t, '/');
+ /*@=branchstate@*/
/*@-nullpass@*/ /* FIX: relocations[i].oldPath == NULL */
/* Verify that the relocation's old path is in the header. */
len = reldel +
strlen(dirNames[dirIndexes[i]]) + strlen(baseNames[i]) + 1;
+ /*@-branchstate@*/
if (len >= fileAlloced) {
fileAlloced = len * 2;
fn = xrealloc(fn, fileAlloced);
}
+ /*@=branchstate@*/
*fn = '\0';
fnlen = stpcpy( stpcpy(fn, dirNames[dirIndexes[i]]), baseNames[i]) - fn;
rpmProblem t = target->probs;
int gotProblems = 0;
+ /*@-branchstate@*/
while ((f - filter->probs) < filter->numProblems) {
if (!f->ignoreProblem) {
f++;
t->ignoreProblem = f->ignoreProblem;
t++, f++;
}
+ /*@=branchstate@*/
if ((t - target->probs) < target->numProblems)
gotProblems = 1;
continue;
j = strlen(fi->dnl[fi->dil[i]]) + strlen(fi->bnl[i]) + 1;
+ /*@-branchstate@*/
if (j > fileSpecAlloced) {
fileSpecAlloced = j * 2;
filespec = xrealloc(filespec, fileSpecAlloced);
}
+ /*@=branchstate@*/
(void) stpcpy( stpcpy( filespec, fi->dnl[fi->dil[i]]), fi->bnl[i]);
noDocs = rpmExpandNumeric("%{_excludedocs}");
{ const char *tmpPath = rpmExpand("%{_netsharedpath}", NULL);
+ /*@-branchstate@*/
if (tmpPath && *tmpPath != '%')
netsharedPaths = splitString(tmpPath, strlen(tmpPath), ':');
+ /*@=branchstate@*/
tmpPath = _free(tmpPath);
}
s = rpmExpand("%{_install_langs}", NULL);
+ /*@-branchstate@*/
if (!(s && *s != '%'))
s = _free(s);
if (s) {
s = _free(s);
} else
languages = NULL;
+ /*@=branchstate@*/
/* Compute directory refcount, skip directory if now empty. */
drc = alloca(fi->dc * sizeof(*drc));
struct availablePackage * alp = NULL;
int oc = iter->ocsave;
+ /*@-branchstate@*/
if (oc != -1) {
rpmTransactionSet ts = iter->ts;
TFI_t fi = ts->flList + oc;
if (ts->addedPackages.list && fi->type == TR_ADDED)
alp = ts->addedPackages.list + ts->order[oc].u.addedIndex;
}
+ /*@=branchstate@*/
return alp;
}
/* XXX watchout: fi->type must be set for tsGetAlp() to "work" */
fi->type = ts->order[oc].type;
+ /*@-branchstate@*/
switch (fi->type) {
case TR_ADDED:
i = ts->order[oc].u.addedIndex;
loadFi(fi->h, fi);
/*@switchbreak@*/ break;
}
+ /*@=branchstate@*/
if (fi->fc)
fi->fps = xmalloc(fi->fc * sizeof(*fi->fps));
i = alp - ts->addedPackages.list;
h = headerLink(fi->h);
+ /*@-branchstate@*/
if (alp->fd == NULL) {
alp->fd = ts->notify(fi->h, RPMCALLBACK_INST_OPEN_FILE, 0, 0,
alp->key, ts->notifyData);
if (alp->fd) gotfd = 1;
}
}
+ /*@=branchstate@*/
if (alp->fd) {
Header hsave = NULL;
return 0;
/*@=nullstate@*/
}
-/*@=branchstate@*/
-/*@-branchstate@*/
/** \ingroup rpmdb dbi
* \file rpmdb/rpmdb.c
*/
}
break;
}
+ /*@-branchstate@*/
if (setp) *setp = set;
+ /*@=branchstate@*/
}
return rc;
}
*matches = NULL;
if (filespec == NULL) return -2;
+ /*@-branchstate@*/
if ((baseName = strrchr(filespec, '/')) != NULL) {
char * t;
size_t len;
dirName = "";
baseName = filespec;
}
+ /*@=branchstate@*/
if (baseName == NULL)
return -2;
gotMatches = 0;
/* Make sure the version and release match. */
+ /*@-branchstate@*/
for (i = 0; i < dbiIndexSetCount(*matches); i++) {
unsigned int recoff = dbiIndexRecordOffset(*matches, i);
Header h;
h = headerFree(h);
}
+ /*@=branchstate@*/
if (gotMatches) {
(*matches)->count = gotMatches;
return mi;
dbi = dbiOpen(mi->mi_rpmdb, RPMDBI_PACKAGES, 0);
+ /*@-branchstate@*/
if (mi->mi_h) {
if (dbi && mi->mi_dbc && mi->mi_modified && mi->mi_prevoffset) {
xx = dbiUpdateRecord(dbi, mi->mi_dbc, mi->mi_prevoffset, mi->mi_h);
}
mi->mi_h = headerFree(mi->mi_h);
}
+ /*@=branchstate@*/
if (dbi) {
if (dbi->dbi_rmw)
xx = dbiCclose(dbi, dbi->dbi_rmw, 0);
mi->mi_release = _free(mi->mi_release);
mi->mi_version = _free(mi->mi_version);
+ /*@-branchstate@*/
if (dbi && mi->mi_dbc)
xx = dbiCclose(dbi, mi->mi_dbc, DBI_ITERATOR);
+ /*@=branchstate@*/
mi->mi_dbc = NULL;
mi->mi_set = dbiFreeIndexSet(mi->mi_set);
mi->mi_keyp = _free(mi->mi_keyp);
if (mode == RPMMIRE_DEFAULT)
mode = defmode;
+ /*@-branchstate@*/
switch (mode) {
case RPMMIRE_DEFAULT:
case RPMMIRE_STRCMP:
rc = -1;
break;
}
+ /*@=branchstate@*/
if (rc) {
/*@=kepttrans@*/ /* FIX: mire has kept values */
mi->mi_h = headerCopyLoad(uh);
/* XXX db1 with hybrid, simulated db interface on falloc.c needs free. */
+ /*@-branchstate@*/
if (dbi->dbi_api == 1) uh = _free(uh);
+ /*@=branchstate@*/
/* Did the header load correctly? */
if (mi->mi_h == NULL || !headerIsEntry(mi->mi_h, RPMTAG_NAME)) {
dbi = NULL;
rpmtag = dbiTags[dbix];
+ /*@-branchstate@*/
switch (rpmtag) {
/* Filter out temporary databases */
case RPMDBI_AVAILABLE:
continue;
/*@notreached@*/ /*@switchbreak@*/ break;
}
+ /*@=branchstate@*/
if (!hge(h, rpmtag, &rpmtype, (void **) &rpmvals, &rpmcnt))
continue;
} else {
/* With duplicates, cursor is positioned, discard the record. */
+ /*@-branchstate@*/
if (rc == 0 && dbi->dbi_permit_dups)
set = dbiFreeIndexSet(set);
+ /*@=branchstate@*/
if (set == NULL || rc < 0) { /* not found */
rc = 0;
size_t datalen = 0;
dbi = dbiOpen(db, RPMDBI_PACKAGES, 0);
+ /*@-branchstate@*/
if (dbi != NULL) {
/* XXX db0: hack to pass sizeof header to fadAlloc */
xx = dbiCclose(dbi, dbcursor, DBI_WRITECURSOR);
dbcursor = NULL;
}
+ /*@=branchstate@*/
}
/*@switchbreak@*/ break;
}
+ /*@-branchstate@*/
if (rpmcnt <= 0) {
if (rpmtag != RPMTAG_GROUP)
continue;
rpmvals = (const char **) "Unknown";
rpmcnt = 1;
}
+ /*@=branchstate@*/
dbi = dbiOpen(db, rpmtag, 0);
if (dbi != NULL) {
char * db1basename (int rpmtag)
{
char * base = NULL;
+ /*@-branchstate@*/
switch (rpmtag) {
case RPMDBI_PACKAGES: base = "packages.rpm"; break;
case RPMTAG_NAME: base = "nameindex.rpm"; break;
(void) stpcpy( stpcpy(base, tn), ".idx");
} break;
}
+ /*@=branchstate@*/
return xstrdup(base);
}
int xx;
i = strlen(dbpath);
+ /*@-branchstate@*/
if (dbpath[i - 1] != '/') {
filename = alloca(i);
strcpy(filename, dbpath);
filename[i + 1] = '\0';
dbpath = filename;
}
+ /*@=branchstate@*/
filename = alloca(strlen(prefix) + strlen(dbpath) + 40);
int xx;
i = strlen(olddbpath);
+ /*@-branchstate@*/
if (olddbpath[i - 1] != '/') {
ofilename = alloca(i + 2);
strcpy(ofilename, olddbpath);
ofilename[i + 1] = '\0';
olddbpath = ofilename;
}
+ /*@=branchstate@*/
i = strlen(newdbpath);
+ /*@-branchstate@*/
if (newdbpath[i - 1] != '/') {
nfilename = alloca(i + 2);
strcpy(nfilename, newdbpath);
nfilename[i + 1] = '\0';
newdbpath = nfilename;
}
+ /*@=branchstate@*/
ofilename = alloca(strlen(prefix) + strlen(olddbpath) + 40);
nfilename = alloca(strlen(prefix) + strlen(newdbpath) + 40);
int _dbapi;
int _dbapi_rebuild;
+ /*@-branchstate@*/
if (prefix == NULL) prefix = "/";
+ /*@=branchstate@*/
_dbapi = rpmExpandNumeric("%{_dbapi}");
_dbapi_rebuild = rpmExpandNumeric("%{_dbapi_rebuild}");
return rc;
}
/*@=globs@*/
-/*@=branchstate@*/
-/*@-branchstate@*/
/** \ingroup rpmio
* \file rpmio/rpmio.c
*/
const char *urlStrerror(const char *url)
{
const char *retstr;
+ /*@-branchstate@*/
switch (urlIsURL(url)) {
case URL_IS_FTP:
case URL_IS_HTTP:
retstr = strerror(errno);
break;
}
+ /*@=branchstate@*/
return retstr;
}
if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = IPPORT_FTP;
+ /*@-branchstate@*/
if ((user = (u->proxyu ? u->proxyu : u->user)) == NULL)
user = "anonymous";
+ /*@=branchstate@*/
+ /*@-branchstate@*/
if ((password = u->password) == NULL) {
uid_t uid = getuid();
struct passwd * pw;
password = "root@";
}
}
+ /*@=branchstate@*/
+ /*@-branchstate@*/
if (fdFileno(u->ctrl) >= 0 && fdWritable(u->ctrl, 0) < 1)
/*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/
+ /*@=branchstate@*/
/*@-usereleased@*/
if (fdFileno(u->ctrl) < 0) {
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
/*@=observertrans@*/
errxit2:
+ /*@-branchstate@*/
if (fdFileno(u->ctrl) >= 0)
/*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/
+ /*@=branchstate@*/
/*@-compdef@*/
return rc;
/*@=compdef@*/
/*@-observertrans@*/
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
/*@=observertrans@*/
+ /*@-branchstate@*/
if (fdFileno(data) >= 0)
/*@-refcounttrans@*/ (void) fdClose(data); /*@=refcounttrans@*/
+ /*@=branchstate@*/
return rc;
}
if ((port = (u->proxyp > 0 ? u->proxyp : u->port)) < 0) port = 80;
path = (u->proxyh || u->proxyp > 0) ? u->url : httpArg;
+ /*@-branchstate@*/
if (path == NULL) path = "";
+ /*@=branchstate@*/
reopen:
+ /*@-branchstate@*/
if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
/*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
}
+ /*@=branchstate@*/
/*@-usereleased@*/
if (fdFileno(ctrl) < 0) {
goto errxit;
}
+ /*@-branchstate@*/
if (!strcmp(httpCmd, "PUT")) {
ctrl->wr_chunked = 1;
} else {
goto errxit;
}
}
+ /*@=branchstate@*/
ctrl = fdLink(ctrl, "open data (httpReq)");
return 0;
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
/*@=observertrans@*/
errxit2:
+ /*@-branchstate@*/
if (fdFileno(ctrl) >= 0)
/*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
+ /*@=branchstate@*/
return rc;
/*@=usereleased@*/
}
return fdSeek(cookie, pos, whence);
}
+/*@-branchstate@*/
/*@-usereleased@*/ /* LCL: fd handling is tricky here. */
int ufdClose( /*@only@*/ void * cookie)
{
UFDONLY(fd);
+ /*@-branchstate@*/
if (fd->url) {
urlinfo u = fd->url;
return fdClose(fd);
}
/*@=usereleased@*/
+/*@=branchstate@*/
/*@-nullstate@*/ /* FIX: u->{ctrl,data}->url undef after XurlLink. */
/*@null@*/ FD_t ftpOpen(const char *url, /*@unused@*/ int flags,
/*@=modfilesys@*/
fd = fdLink(fd, "Fclose");
+ /*@-branchstate@*/
while (fd->nfps >= 0) {
FDSTACK_t * fps = &fd->fps[fd->nfps];
ec = rc;
fdPop(fd);
}
+ /*@=branchstate@*/
fd = fdFree(fd, "Fclose");
return ec;
/*@=usereleased@*/
if (end == NULL && other[0] == '\0')
/*@-refcounttrans -retalias@*/ return fd; /*@=refcounttrans =retalias@*/
+ /*@-branchstate@*/
if (end && *end) {
if (!strcmp(end, "fdio")) {
iof = fdio;
/*@=internalglobs@*/
}
}
+ /*@=branchstate@*/
if (iof == NULL)
/*@-refcounttrans -retalias@*/ return fd; /*@=refcounttrans =retalias@*/
if (stdio[0] == '\0')
return NULL;
+ /*@-branchstate@*/
if (end == NULL || !strcmp(end, "fdio")) {
if (_rpmio_debug)
fprintf(stderr, "*** Fopen fdio path %s fmode %s\n", path, fmode);
return fd;
}
}
+ /*@=branchstate@*/
+ /*@-branchstate@*/
if (fd)
fd = Fdopen(fd, fmode);
+ /*@=branchstate@*/
return fd;
}
ufdOpen, NULL, fdGetFp, NULL, Mkdir, Chdir, Rmdir, Rename, Unlink
};
FDIO_t fpio = /*@-compmempass@*/ &fpio_s /*@=compmempass@*/ ;
-/*@=branchstate@*/