Splint fiddles.
CVS patchset: 7195 CVS date: 2004/03/26 17:27:57
This commit is contained in:
parent
18fe40be2d
commit
60057a2de1
|
@ -1,4 +1,4 @@
|
|||
-I. -I./build -I./lib -I./rpmdb -I./rpmio -I./beecrypt -I./file -I./popt -I./elfutils/libelf -I./zlib -I/usr/lib/gcc-lib/i386-redhat-linux/3.1/include -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DHAVE_DEV_DSP -DHAVE_SYS_SOUNDCARD
|
||||
-I. -I./build -I./lib -I./rpmdb -I./rpmio -I./beecrypt -I./lua/include -I./lua/local -I./file -I./popt -I./elfutils/libelf -I./zlib -I/usr/lib/gcc-lib/i386-redhat-linux/3.1/include -DHAVE_CONFIG_H -D_GNU_SOURCE -D_REENTRANT -DHAVE_DEV_DSP -DHAVE_SYS_SOUNDCARD
|
||||
|
||||
#+partial
|
||||
+forcehints
|
||||
|
|
|
@ -2182,7 +2182,7 @@ if (!(fsm->mapFlags & CPIO_ALL_HARDLINKS)) break;
|
|||
rpmMessage(RPMMESS_DEBUG, " %8s (%s, %s) %s\n", cur,
|
||||
fsm->path, fsm->fcontext,
|
||||
(rc < 0 ? strerror(errno) : ""));
|
||||
if (rc < 0) rc = (errno == ENOTSUP ? 0 : CPIOERR_LSETFCON_FAILED);
|
||||
if (rc < 0) rc = (errno == EOPNOTSUPP ? 0 : CPIOERR_LSETFCON_FAILED);
|
||||
break;
|
||||
case FSM_CHOWN:
|
||||
rc = chown(fsm->path, st->st_uid, st->st_gid);
|
||||
|
|
121
lib/psm.c
121
lib/psm.c
|
@ -42,7 +42,10 @@ int _psm_threads = 0;
|
|||
/* Give access to the rpmte global tracking the last instance added
|
||||
* to the database.
|
||||
*/
|
||||
/*@-exportheadervar@*/
|
||||
/*@unchecked@*/
|
||||
extern unsigned int myinstall_instance;
|
||||
/*@=exportheadervar@*/
|
||||
|
||||
/*@access FD_t @*/ /* XXX void ptr args */
|
||||
/*@access rpmpsm @*/
|
||||
|
@ -51,6 +54,10 @@ extern unsigned int myinstall_instance;
|
|||
/*@access rpmte @*/ /* XXX rpmInstallSourcePackage */
|
||||
/*@access rpmts @*/ /* XXX ts->notify */
|
||||
|
||||
/*@access rpmluav @*/
|
||||
/*@access rpmtsScore @*/
|
||||
/*@access rpmtsScoreEntry @*/
|
||||
|
||||
int rpmVersionCompare(Header first, Header second)
|
||||
{
|
||||
const char * one, * two;
|
||||
|
@ -563,9 +570,11 @@ exit:
|
|||
/**
|
||||
* Run internal Lua script.
|
||||
*/
|
||||
rpmRC runLuaScript(rpmpsm psm, Header h, const char *sln,
|
||||
static rpmRC runLuaScript(rpmpsm psm, Header h, const char *sln,
|
||||
int progArgc, const char **progArgv,
|
||||
const char *script, int arg1, int arg2)
|
||||
/*@globals fileSystem, internalState @*/
|
||||
/*@modifies psm, fileSystem, internalState @*/
|
||||
{
|
||||
const rpmts ts = psm->ts;
|
||||
int rootFd = -1;
|
||||
|
@ -575,17 +584,21 @@ rpmRC runLuaScript(rpmpsm psm, Header h, const char *sln,
|
|||
int xx;
|
||||
rpmlua lua = NULL; /* Global state. */
|
||||
rpmluav var;
|
||||
|
||||
|
||||
xx = headerNVR(h, &n, &v, &r);
|
||||
|
||||
if (!rpmtsChrootDone(ts)) {
|
||||
const char *rootDir = rpmtsRootDir(ts);
|
||||
if (rootDir != NULL && !(rootDir[0] == '/' && rootDir[1] == '\0')) {
|
||||
chdir("/");
|
||||
xx = chdir("/");
|
||||
/*@-nullpass@*/
|
||||
rootFd = open(".", O_RDONLY, 0);
|
||||
/*@=nullpass@*/
|
||||
if (rootFd >= 0) {
|
||||
chroot(rootDir);
|
||||
rpmtsSetChrootDone(ts, 1);
|
||||
/*@-superuser -noeffect @*/
|
||||
xx = chroot(rootDir);
|
||||
/*@=superuser =noeffect @*/
|
||||
xx = rpmtsSetChrootDone(ts, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -594,6 +607,7 @@ rpmRC runLuaScript(rpmpsm psm, Header h, const char *sln,
|
|||
rpmluaPushTable(lua, "arg");
|
||||
var = rpmluavNew();
|
||||
rpmluavSetListMode(var, 1);
|
||||
/*@+relaxtypes@*/
|
||||
if (progArgv) {
|
||||
for (i = 0; i < progArgc && progArgv[i]; i++) {
|
||||
rpmluavSetValue(var, RPMLUAV_STRING, progArgv[i]);
|
||||
|
@ -608,12 +622,15 @@ rpmRC runLuaScript(rpmpsm psm, Header h, const char *sln,
|
|||
rpmluavSetValueNum(var, arg2);
|
||||
rpmluaSetVar(lua, var);
|
||||
}
|
||||
/*@=relaxtypes@*/
|
||||
/*@-moduncon@*/
|
||||
var = rpmluavFree(var);
|
||||
/*@=moduncon@*/
|
||||
rpmluaPop(lua);
|
||||
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
snprintf(buf, BUFSIZ, "%s(%s-%s-%s)", sln, n, v, r);
|
||||
xx = snprintf(buf, BUFSIZ, "%s(%s-%s-%s)", sln, n, v, r);
|
||||
if (rpmluaRunScript(lua, script, buf) == -1)
|
||||
rc = RPMRC_FAIL;
|
||||
}
|
||||
|
@ -621,10 +638,12 @@ rpmRC runLuaScript(rpmpsm psm, Header h, const char *sln,
|
|||
rpmluaDelVar(lua, "arg");
|
||||
|
||||
if (rootFd >= 0) {
|
||||
fchdir(rootFd);
|
||||
close(rootFd);
|
||||
chroot(".");
|
||||
rpmtsSetChrootDone(ts, 0);
|
||||
xx = fchdir(rootFd);
|
||||
xx = close(rootFd);
|
||||
/*@-superuser -noeffect @*/
|
||||
xx = chroot(".");
|
||||
/*@=superuser =noeffect @*/
|
||||
xx = rpmtsSetChrootDone(ts, 0);
|
||||
}
|
||||
|
||||
exit:
|
||||
|
@ -646,7 +665,7 @@ static const char * ldconfig_path = "/sbin/ldconfig";
|
|||
* Run a script with an interpreter. If the interpreter is not specified,
|
||||
* /bin/sh will be used. If the interpreter is /bin/sh, then the args from
|
||||
* the header will be ignored, passing instead arg1 and arg2.
|
||||
*
|
||||
*
|
||||
* @param psm package state machine data
|
||||
* @param h header
|
||||
* @param sln name of scriptlet section
|
||||
|
@ -659,7 +678,7 @@ static const char * ldconfig_path = "/sbin/ldconfig";
|
|||
* @return 0 on success
|
||||
*/
|
||||
static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
|
||||
int progArgc, const char ** progArgv,
|
||||
int progArgc, const char ** progArgv,
|
||||
const char * script, int arg1, int arg2)
|
||||
/*@globals ldconfig_done, rpmGlobalMacroContext, h_errno,
|
||||
fileSystem, internalState@*/
|
||||
|
@ -708,7 +727,7 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
|
|||
/*
|
||||
* If a successor node, and ldconfig was just run, don't bother.
|
||||
*/
|
||||
if (ldconfig_path && progArgv && psm->unorderedSuccessor) {
|
||||
if (ldconfig_path && progArgv != NULL && psm->unorderedSuccessor) {
|
||||
if (ldconfig_done && !strcmp(progArgv[0], ldconfig_path)) {
|
||||
rpmMessage(RPMMESS_DEBUG,
|
||||
_("%s: %s(%s-%s-%s) skipping redundant \"%s\".\n"),
|
||||
|
@ -814,7 +833,7 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
|
|||
out = fdDup(STDOUT_FILENO);
|
||||
}
|
||||
if (out == NULL) return RPMRC_FAIL; /* XXX can't happen */
|
||||
|
||||
|
||||
/*@-branchstate@*/
|
||||
xx = rpmsqFork(&psm->sq);
|
||||
if (psm->sq.child == 0) {
|
||||
|
@ -945,7 +964,7 @@ static rpmRC runScript(rpmpsm psm, Header h, const char * sln,
|
|||
if (freePrefixes) prefixes = hfd(prefixes, ipt);
|
||||
|
||||
xx = Fclose(out); /* XXX dup'd STDOUT_FILENO */
|
||||
|
||||
|
||||
/*@-branchstate@*/
|
||||
if (script) {
|
||||
if (!rpmIsDebug())
|
||||
|
@ -1088,7 +1107,7 @@ static rpmRC handleOneTrigger(const rpmpsm psm,
|
|||
triggersAlreadyRun[index] == 0)
|
||||
{
|
||||
rc = runScript(psm, triggeredH, "%trigger", 1,
|
||||
triggerProgs + index, triggerScripts[index],
|
||||
triggerProgs + index, triggerScripts[index],
|
||||
arg1, arg2);
|
||||
if (triggersAlreadyRun != NULL)
|
||||
triggersAlreadyRun[index] = 1;
|
||||
|
@ -1200,7 +1219,7 @@ static rpmRC runImmedTriggers(rpmpsm psm)
|
|||
mi = rpmtsInitIterator(ts, RPMTAG_NAME, triggerNames[i], 0);
|
||||
|
||||
while((sourceH = rpmdbNextIterator(mi)) != NULL) {
|
||||
rc |= handleOneTrigger(psm, sourceH, fi->h,
|
||||
rc |= handleOneTrigger(psm, sourceH, fi->h,
|
||||
rpmdbGetIteratorCount(mi),
|
||||
triggersRun);
|
||||
}
|
||||
|
@ -1374,7 +1393,7 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
|
|||
rpmfiFC(fi), (rpmtsFlags(ts) & RPMTRANS_FLAG_TEST));
|
||||
|
||||
/*
|
||||
* When we run scripts, we pass an argument which is the number of
|
||||
* When we run scripts, we pass an argument which is the number of
|
||||
* versions of this package that will be installed when we are
|
||||
* finished.
|
||||
*/
|
||||
|
@ -1385,41 +1404,41 @@ rpmRC rpmpsmStage(rpmpsm psm, pkgStage stage)
|
|||
}
|
||||
|
||||
/* If we have a score then autorollback is enabled. If autorollback is
|
||||
* enabled, and this is an autorollback transaction, then we may need to
|
||||
* enabled, and this is an autorollback transaction, then we may need to
|
||||
* adjust the pkgs installed count.
|
||||
*
|
||||
*
|
||||
* If all this is true, this adjustment should only be made if the PSM goal
|
||||
* is an install. No need to make this adjustment on the erase
|
||||
* component of the upgrade, or even more absurd to do this when doing a
|
||||
* is an install. No need to make this adjustment on the erase
|
||||
* component of the upgrade, or even more absurd to do this when doing a
|
||||
* PKGSAVE.
|
||||
*/
|
||||
if(rpmtsGetScore(ts) != NULL &&
|
||||
if (rpmtsGetScore(ts) != NULL &&
|
||||
rpmtsGetType(ts) == RPMTRANS_TYPE_AUTOROLLBACK &&
|
||||
(psm->goal & ~(PSM_PKGSAVE|PSM_PKGERASE))) {
|
||||
/* Get the score, if its not NULL, get the appropriate
|
||||
/* Get the score, if its not NULL, get the appropriate
|
||||
* score entry.
|
||||
*/
|
||||
rpmtsScore score = rpmtsGetScore(ts);
|
||||
if(score != NULL) {
|
||||
if (score != NULL) {
|
||||
/* OK, we got a real score so lets get the appropriate
|
||||
* score entry.
|
||||
*/
|
||||
rpmtsScoreEntry se;
|
||||
se = rpmtsScoreGetEntry(score, rpmteN(psm->te));
|
||||
|
||||
/* IF the header for the install element has been installed,
|
||||
/* IF the header for the install element has been installed,
|
||||
* but the header for the erase element has not been erased,
|
||||
* then decrement the instance count. This is because in an
|
||||
* then decrement the instance count. This is because in an
|
||||
* autorollback, if the header was added in the initial transaction
|
||||
* then in the case of an upgrade the instance count will be
|
||||
* then in the case of an upgrade the instance count will be
|
||||
* 2 instead of one when re-installing the old package, and 3 when
|
||||
* erasing the new package.
|
||||
*
|
||||
*
|
||||
* Another wrinkle is we only want to make this adjustement
|
||||
* if the thing we are rollback was an upgrade of package. A pure
|
||||
* install or erase does not need the adjustment
|
||||
*/
|
||||
if(se && se->installed &&
|
||||
if (se && se->installed &&
|
||||
!se->erased &&
|
||||
(se->te_types & (TR_ADDED|TR_REMOVED)))
|
||||
psm->npkgs_installed--;
|
||||
|
@ -1470,7 +1489,7 @@ assert(psm->mi == NULL);
|
|||
*/
|
||||
{ const char * p;
|
||||
xx = hge(fi->h, RPMTAG_DEFAULTPREFIX, NULL, (void **) &p, NULL);
|
||||
fi->striplen = (xx ? strlen(p) + 1 : 1);
|
||||
fi->striplen = (xx ? strlen(p) + 1 : 1);
|
||||
}
|
||||
fi->mapflags =
|
||||
CPIO_MAP_PATH | CPIO_MAP_MODE | CPIO_MAP_UID | CPIO_MAP_GID;
|
||||
|
@ -2092,26 +2111,26 @@ assert(psm->mi == NULL);
|
|||
* If the score exists and this is not a rollback or autorollback
|
||||
* then lets check off installed for this package.
|
||||
*/
|
||||
if(rpmtsGetScore(ts) != NULL &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_ROLLBACK &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_AUTOROLLBACK) {
|
||||
/* Get the score, if its not NULL, get the appropriate
|
||||
* score entry.
|
||||
*/
|
||||
rpmtsScore score = rpmtsGetScore(ts);
|
||||
if(score != NULL) {
|
||||
if (rpmtsGetScore(ts) != NULL &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_ROLLBACK &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_AUTOROLLBACK)
|
||||
{
|
||||
/* Get the score, if its not NULL, get the appropriate
|
||||
* score entry.
|
||||
*/
|
||||
rpmtsScore score = rpmtsGetScore(ts);
|
||||
if (score != NULL) {
|
||||
rpmtsScoreEntry se;
|
||||
/* OK, we got a real score so lets get the appropriate
|
||||
* score entry.
|
||||
*/
|
||||
rpmMessage(RPMMESS_DEBUG,
|
||||
_("Attempting to mark %s as installed in score board(0x%x).\n"),
|
||||
_("Attempting to mark %s as installed in score board(%p).\n"),
|
||||
rpmteN(psm->te), score);
|
||||
rpmtsScoreEntry se;
|
||||
se = rpmtsScoreGetEntry(score, rpmteN(psm->te));
|
||||
if(se) se->installed = 1;
|
||||
if (se != NULL) se->installed = 1;
|
||||
}
|
||||
}
|
||||
|
||||
(void) rpmswExit(rpmtsOp(ts, RPMTS_OP_DBADD), 0);
|
||||
break;
|
||||
case PSM_RPMDB_REMOVE:
|
||||
|
@ -2124,23 +2143,25 @@ assert(psm->mi == NULL);
|
|||
* If the score exists and this is not a rollback or autorollback
|
||||
* then lets check off erased for this package.
|
||||
*/
|
||||
if(rpmtsGetScore(ts) != NULL &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_ROLLBACK &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_AUTOROLLBACK) {
|
||||
if (rpmtsGetScore(ts) != NULL &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_ROLLBACK &&
|
||||
rpmtsGetType(ts) != RPMTRANS_TYPE_AUTOROLLBACK)
|
||||
{
|
||||
/* Get the score, if its not NULL, get the appropriate
|
||||
* score entry.
|
||||
*/
|
||||
rpmtsScore score = rpmtsGetScore(ts);
|
||||
if(score != NULL) { /* XXX: Can't happen */
|
||||
|
||||
if (score != NULL) { /* XXX: Can't happen */
|
||||
rpmtsScoreEntry se;
|
||||
/* OK, we got a real score so lets get the appropriate
|
||||
* score entry.
|
||||
*/
|
||||
rpmMessage(RPMMESS_DEBUG,
|
||||
_("Attempting to mark %s as erased in score board(0x%x).\n"),
|
||||
rpmteN(psm->te), score);
|
||||
rpmtsScoreEntry se;
|
||||
rpmteN(psm->te), (unsigned) score);
|
||||
se = rpmtsScoreGetEntry(score, rpmteN(psm->te));
|
||||
if(se) se->erased = 1;
|
||||
if (se != NULL) se->erased = 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ typedef struct {
|
|||
} * rpmlock;
|
||||
|
||||
/*@null@*/
|
||||
static rpmlock rpmlock_new(const char *rootdir)
|
||||
static rpmlock rpmlock_new(/*@unused@*/ const char *rootdir)
|
||||
/*@globals fileSystem @*/
|
||||
/*@modifies fileSystem @*/
|
||||
{
|
||||
|
@ -49,10 +49,14 @@ static rpmlock rpmlock_new(const char *rootdir)
|
|||
free(lock);
|
||||
lock = NULL;
|
||||
} else {
|
||||
/*@-nullderef@*/ /* XXX splint on crack */
|
||||
lock->openmode = RPMLOCK_READ;
|
||||
/*@=nullderef@*/
|
||||
}
|
||||
} else {
|
||||
/*@-nullderef@*/ /* XXX splint on crack */
|
||||
lock->openmode = RPMLOCK_WRITE | RPMLOCK_READ;
|
||||
/*@=nullderef@*/
|
||||
}
|
||||
/*@=branchstate@*/
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ struct rpmte_s {
|
|||
FD_t fd; /*!< (TR_ADDED) Payload file descriptor. */
|
||||
|
||||
/*@-fielduse@*/ /* LCL: confused by union? */
|
||||
union {
|
||||
union {
|
||||
/*@exposed@*/ /*@dependent@*/ /*@null@*/
|
||||
alKey addedKey;
|
||||
struct {
|
||||
|
@ -259,7 +259,8 @@ uint_32 rpmteSetColor(rpmte te, uint_32 color)
|
|||
* @param te transaction element
|
||||
* @return last install instance.
|
||||
*/
|
||||
unsigned int rpmteDBInstance(rpmte te);
|
||||
unsigned int rpmteDBInstance(rpmte te)
|
||||
/*@*/;
|
||||
|
||||
/**
|
||||
* Set last instance installed to the database.
|
||||
|
@ -267,7 +268,8 @@ unsigned int rpmteDBInstance(rpmte te);
|
|||
* @param instance Database instance of last install element.
|
||||
* @return last install instance.
|
||||
*/
|
||||
void rpmteSetDBInstance(rpmte te, unsigned int instance);
|
||||
void rpmteSetDBInstance(rpmte te, unsigned int instance)
|
||||
/*@modifies te @*/;
|
||||
|
||||
/**
|
||||
* Retrieve size in bytes of package file.
|
||||
|
|
56
lib/rpmts.c
56
lib/rpmts.c
|
@ -834,7 +834,9 @@ rpmts rpmtsFree(rpmts ts)
|
|||
rpmtsPrintStats(ts);
|
||||
|
||||
/* Free up the memory used by the rpmtsScore */
|
||||
rpmtsScoreFree(ts->score);
|
||||
/*@-kepttrans -onlytrans @*/
|
||||
ts->score = rpmtsScoreFree(ts->score);
|
||||
/*@=kepttrans =onlytrans @*/
|
||||
|
||||
(void) rpmtsUnlink(ts, "tsCreate");
|
||||
|
||||
|
@ -879,7 +881,7 @@ rpmVSFlags rpmtsSetVSFlags(rpmts ts, rpmVSFlags vsflags)
|
|||
*/
|
||||
void rpmtsSetType(rpmts ts, rpmtsType type)
|
||||
{
|
||||
if(ts != NULL) {
|
||||
if (ts != NULL) {
|
||||
ts->type = type;
|
||||
}
|
||||
}
|
||||
|
@ -887,7 +889,7 @@ void rpmtsSetType(rpmts ts, rpmtsType type)
|
|||
/* Let them know what type of transaction we are */
|
||||
rpmtsType rpmtsGetType(rpmts ts)
|
||||
{
|
||||
if(ts != NULL)
|
||||
if (ts != NULL)
|
||||
return ts->type;
|
||||
else
|
||||
return 0;
|
||||
|
@ -1530,12 +1532,12 @@ rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS)
|
|||
rpmRC rc = RPMRC_OK; /* Assume success */
|
||||
rpmtsScoreEntry se;
|
||||
|
||||
rpmMessage(RPMMESS_DEBUG, _("Creating transaction score board(0x%x, 0x%x)\n"),
|
||||
rpmMessage(RPMMESS_DEBUG, _("Creating transaction score board(%p, %p)\n"),
|
||||
runningTS, rollbackTS);
|
||||
|
||||
/* Allocate space for score board */
|
||||
score = xcalloc(1, sizeof(*score));
|
||||
rpmMessage(RPMMESS_DEBUG, _("\tScore board address: 0x%x\n"), score);
|
||||
rpmMessage(RPMMESS_DEBUG, _("\tScore board address: %p\n"), score);
|
||||
|
||||
/*
|
||||
* Determine the maximum size needed for the entry list.
|
||||
|
@ -1563,18 +1565,20 @@ rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS)
|
|||
/* Try to find the entry in the score list */
|
||||
for(i = 0; i < score->entries; i++) {
|
||||
se = score->scores[i];
|
||||
if(strcmp(rpmteN(p), se->N) == 0) {
|
||||
if (strcmp(rpmteN(p), se->N) == 0) {
|
||||
found = 1;
|
||||
break;
|
||||
/*@innerbreak@*/ break;
|
||||
}
|
||||
}
|
||||
|
||||
/* If we did not find the entry then allocate space for it */
|
||||
if(!found) {
|
||||
if (!found) {
|
||||
/*@-compdef -usereleased@*/ /* XXX p->fi->te undefined. */
|
||||
rpmMessage(RPMMESS_DEBUG, _("\tAdding entry for %s to score board.\n"),
|
||||
rpmteN(p));
|
||||
/*@=compdef =usereleased@*/
|
||||
se = xcalloc(1, sizeof(*(*(score->scores))));
|
||||
rpmMessage(RPMMESS_DEBUG, _("\t\tEntry address: 0x%x\n"), se);
|
||||
rpmMessage(RPMMESS_DEBUG, _("\t\tEntry address: %p\n"), se);
|
||||
se->N = xstrdup(rpmteN(p));
|
||||
se->te_types = rpmteType(p);
|
||||
se->installed = 0;
|
||||
|
@ -1605,17 +1609,17 @@ rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS)
|
|||
return rc;
|
||||
}
|
||||
|
||||
rpmRC rpmtsScoreFree(rpmtsScore score)
|
||||
rpmtsScore rpmtsScoreFree(rpmtsScore score)
|
||||
{
|
||||
int i;
|
||||
rpmtsScoreEntry se = NULL;
|
||||
int i;
|
||||
|
||||
rpmMessage(RPMMESS_DEBUG, _("May free Score board(0x%x)\n"), score);
|
||||
rpmMessage(RPMMESS_DEBUG, _("May free Score board(%p)\n"), score);
|
||||
|
||||
/* If score is not initialized, then just return.
|
||||
* This is likely the case if autorollbacks are not enabled.
|
||||
*/
|
||||
if(score == NULL) return RPMRC_OK;
|
||||
if (score == NULL) return NULL;
|
||||
|
||||
/* Decrement the reference count */
|
||||
score->nrefs--;
|
||||
|
@ -1623,29 +1627,31 @@ rpmRC rpmtsScoreFree(rpmtsScore score)
|
|||
/* Do we have any more references? If so
|
||||
* just return.
|
||||
*/
|
||||
if(score->nrefs > 0) return RPMRC_OK;
|
||||
if (score->nrefs > 0) return NULL;
|
||||
|
||||
rpmMessage(RPMMESS_DEBUG, _("\tRefcount is zero...will free\n"), score);
|
||||
rpmMessage(RPMMESS_DEBUG, _("\tRefcount is zero...will free\n"));
|
||||
/* No more references, lets clean up */
|
||||
/* First deallocate the score entries */
|
||||
/*@-branchstate@*/
|
||||
for(i = 0; i < score->entries; i++) {
|
||||
/* Get the score for the ith entry */
|
||||
se = score->scores[i];
|
||||
|
||||
/* Deallocate the score entries name */
|
||||
_free(se->N);
|
||||
se->N = _free(se->N);
|
||||
|
||||
/* Deallocate the score entry itself */
|
||||
_free(se);
|
||||
se = _free(se);
|
||||
}
|
||||
/*@=branchstate@*/
|
||||
|
||||
/* Next deallocate the score entry table */
|
||||
_free(score->scores);
|
||||
score->scores = _free(score->scores);
|
||||
|
||||
/* Finally deallocate the score itself */
|
||||
_free(score);
|
||||
score = _free(score);
|
||||
|
||||
return RPMRC_OK;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1655,7 +1661,7 @@ rpmRC rpmtsScoreFree(rpmtsScore score)
|
|||
*/
|
||||
rpmtsScore rpmtsGetScore(rpmts ts)
|
||||
{
|
||||
if(ts == NULL) return NULL;
|
||||
if (ts == NULL) return NULL;
|
||||
return ts->score;
|
||||
}
|
||||
|
||||
|
@ -1673,17 +1679,19 @@ rpmtsScoreEntry rpmtsScoreGetEntry(rpmtsScore score, const char *N)
|
|||
rpmtsScoreEntry se;
|
||||
rpmtsScoreEntry ret = NULL; /* Assume we don't find it */
|
||||
|
||||
rpmMessage(RPMMESS_DEBUG, _("Looking in score board(0x%x) for %s\n"), score, N);
|
||||
rpmMessage(RPMMESS_DEBUG, _("Looking in score board(%p) for %s\n"), score, N);
|
||||
|
||||
/* Try to find the entry in the score list */
|
||||
for(i = 0; i < score->entries; i++) {
|
||||
se = score->scores[i];
|
||||
if(strcmp(N, se->N) == 0) {
|
||||
rpmMessage(RPMMESS_DEBUG, _("\tFound entry at address: 0x%x\n"), se);
|
||||
if (strcmp(N, se->N) == 0) {
|
||||
rpmMessage(RPMMESS_DEBUG, _("\tFound entry at address: %p\n"), se);
|
||||
ret = se;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*@-compdef@*/ /* XXX score->scores undefined. */
|
||||
return ret;
|
||||
/*@=compdef@*/
|
||||
}
|
||||
|
|
71
lib/rpmts.h
71
lib/rpmts.h
|
@ -100,7 +100,7 @@ typedef enum rpmtsOpX_e {
|
|||
/**********************
|
||||
* Transaction Scores *
|
||||
**********************
|
||||
*
|
||||
*
|
||||
* In order to allow instance counts to be adjusted properly when an
|
||||
* autorollback transaction is ran, we keep a list that is indexed
|
||||
* by rpm name of whether the rpm has been installed or erased. This listed
|
||||
|
@ -115,17 +115,17 @@ typedef enum rpmtsOpX_e {
|
|||
* at the point the running transaction failed, and thus on a per package
|
||||
* basis make adjustments to the instance counts.
|
||||
*
|
||||
* XXX: Jeff, I am not convinced that this does not need to be in its own file
|
||||
* (i.e. rpmtsScore.{h,c}), but I first wanted to get it working.
|
||||
* XXX: Jeff, I am not convinced that this does not need to be in its own file
|
||||
* (i.e. rpmtsScore.{h,c}), but I first wanted to get it working.
|
||||
*/
|
||||
struct rpmtsScoreEntry_s {
|
||||
char * N; /*!<Name of package */
|
||||
rpmElementType te_types; /*!<te types this entry represents */
|
||||
int installed; /*!<Was the new header installed */
|
||||
int erased; /*!<Was the old header removed */
|
||||
char * N; /*!<Name of package */
|
||||
rpmElementType te_types; /*!<te types this entry represents */
|
||||
int installed; /*!<Was the new header installed */
|
||||
int erased; /*!<Was the old header removed */
|
||||
};
|
||||
|
||||
typedef struct rpmtsScoreEntry_s * rpmtsScoreEntry;
|
||||
typedef /*@abstract@*/ struct rpmtsScoreEntry_s * rpmtsScoreEntry;
|
||||
|
||||
struct rpmtsScore_s {
|
||||
int entries; /*!< Number of scores */
|
||||
|
@ -133,38 +133,48 @@ struct rpmtsScore_s {
|
|||
int nrefs; /*!< Reference count. */
|
||||
};
|
||||
|
||||
typedef struct rpmtsScore_s * rpmtsScore;
|
||||
typedef /*@abstract@*/ struct rpmtsScore_s * rpmtsScore;
|
||||
|
||||
|
||||
/** \ingroup rpmts
|
||||
* initialize rpmtsScore for running transaction and autorollback
|
||||
* initialize rpmtsScore for running transaction and autorollback
|
||||
* transaction.
|
||||
* @param runningTS Running Transaction.
|
||||
* @param rollbackTS Rollback Transaction.
|
||||
* @return RPMRC_OK
|
||||
*/
|
||||
rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS);
|
||||
rpmRC rpmtsScoreInit(rpmts runningTS, rpmts rollbackTS)
|
||||
/*@globals fileSystem @*/
|
||||
/*@modifies runningTS, rollbackTS, fileSystem @*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Free rpmtsScore provided no more references exist against it.
|
||||
* @param score rpmtsScore to free
|
||||
* @return RPMRC_OK
|
||||
* @return NULL always
|
||||
*/
|
||||
rpmRC rpmtsScoreFree(rpmtsScore score);
|
||||
/*@-exportlocal@*/
|
||||
/*@null@*/
|
||||
rpmtsScore rpmtsScoreFree(/*@only@*/ /*@null@*/ rpmtsScore score)
|
||||
/*@modifies score @*/;
|
||||
/*@=exportlocal@*/
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Get rpmtsScore from transaction.
|
||||
* @param ts RPM Transaction.
|
||||
* @return rpmtsScore or NULL.
|
||||
*/
|
||||
rpmtsScore rpmtsGetScore(rpmts ts);
|
||||
/*@exposed@*/ /*@null@*/
|
||||
rpmtsScore rpmtsGetScore(rpmts ts)
|
||||
/*@*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* Get rpmtsScoreEntry from rpmtsScore.
|
||||
* @param score RPM Transaction Score.
|
||||
* @return rpmtsScoreEntry or NULL.
|
||||
*/
|
||||
rpmtsScoreEntry rpmtsScoreGetEntry(rpmtsScore score, const char *N);
|
||||
/*@null@*/
|
||||
rpmtsScoreEntry rpmtsScoreGetEntry(rpmtsScore score, const char *N)
|
||||
/*@*/;
|
||||
|
||||
/** \ingroup rpmts
|
||||
* \file lib/rpmts.h
|
||||
|
@ -317,6 +327,7 @@ struct rpmts_s {
|
|||
/*@null@*/
|
||||
Spec spec; /*!< Spec file control structure. */
|
||||
|
||||
/*@kept@*/ /*@null@*/
|
||||
rpmtsScore score; /*!< Transaction Score (autorollback). */
|
||||
|
||||
/*@refs@*/
|
||||
|
@ -536,25 +547,27 @@ int rpmtsSetSolveCallback(rpmts ts,
|
|||
const void * solveData)
|
||||
/*@modifies ts @*/;
|
||||
|
||||
/**
|
||||
* Set transaction type. Allowed types are:
|
||||
*
|
||||
* RPMTRANS_TYPE_NORMAL
|
||||
* RPMTRANS_TYPE_ROLLBACK
|
||||
* RPMTRANS_TYPE_AUTOROLLBACK
|
||||
*
|
||||
* @param ts transaction set
|
||||
* @param rollback rpmtsType
|
||||
* @return void
|
||||
*/
|
||||
void rpmtsSetType(rpmts ts, rpmtsType type);
|
||||
|
||||
/**
|
||||
* Return the type of a transaction.
|
||||
* @param ts transaction set
|
||||
* @return 0 it is not, 1 it is.
|
||||
*/
|
||||
rpmtsType rpmtsGetType(rpmts ts);
|
||||
rpmtsType rpmtsGetType(rpmts ts)
|
||||
/*@*/;
|
||||
|
||||
/**
|
||||
* Set transaction type. Allowed types are:
|
||||
*
|
||||
* RPMTRANS_TYPE_NORMAL
|
||||
* RPMTRANS_TYPE_ROLLBACK
|
||||
* RPMTRANS_TYPE_AUTOROLLBACK
|
||||
*
|
||||
* @param ts transaction set
|
||||
* @param rollback rpmtsType
|
||||
* @return void
|
||||
*/
|
||||
void rpmtsSetType(rpmts ts, rpmtsType type)
|
||||
/*@modifies ts @*/;
|
||||
|
||||
/**
|
||||
* Return current transaction set problems.
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -13,6 +13,13 @@ print cmp(ds2,ds2)
|
|||
print ds1 == ds2
|
||||
print ds2 == ds1
|
||||
print ds2 == ds2
|
||||
|
||||
print ds1 != ds2
|
||||
print ds2 != ds1
|
||||
print ds2 != ds2
|
||||
|
||||
print ds1 > ds2
|
||||
print ds2 < ds1
|
||||
print ds1 >= ds2
|
||||
print ds2 <= ds1
|
||||
|
||||
|
|
|
@ -2866,7 +2866,9 @@ DBT * data = alloca(sizeof(*data));
|
|||
* we won't have bogus information (i.e. the last succesful
|
||||
* add).
|
||||
*/
|
||||
/*@-mods@*/
|
||||
myinstall_instance = 0;
|
||||
/*@=mods@*/
|
||||
|
||||
if (db == NULL)
|
||||
return 0;
|
||||
|
@ -2976,13 +2978,13 @@ memset(data, 0, sizeof(*data));
|
|||
|
||||
if (hdrNum)
|
||||
{
|
||||
/* Need to save the header number for the current
|
||||
* transaction.
|
||||
*/
|
||||
myinstall_instance = hdrNum;
|
||||
|
||||
dbiIndexItem rec = dbiIndexNewItem(hdrNum, 0);
|
||||
|
||||
/* Save the header number for the current transaction. */
|
||||
/*@-mods@*/
|
||||
myinstall_instance = hdrNum;
|
||||
/*@=mods@*/
|
||||
|
||||
if (dbiTags != NULL)
|
||||
for (dbix = 0; dbix < dbiTagsMax; dbix++) {
|
||||
const char *av[1];
|
||||
|
@ -3018,7 +3020,9 @@ memset(data, 0, sizeof(*data));
|
|||
mi_offset.ui = hdrNum;
|
||||
if (dbiByteSwapped(dbi) == 1)
|
||||
_DBSWAP(mi_offset);
|
||||
/*@-immediatetrans@*/
|
||||
key->data = (void *) &mi_offset;
|
||||
/*@=immediatetrans@*/
|
||||
key->size = sizeof(mi_offset.ui);
|
||||
data->data = headerUnload(h);
|
||||
data->size = headerSizeof(h, HEADER_MAGIC_NO);
|
||||
|
|
|
@ -1516,7 +1516,7 @@ expandMacro(MacroBuf mb)
|
|||
#define POPT_ARGV_ARRAY_GROW_DELTA 5
|
||||
|
||||
/*@-boundswrite@*/
|
||||
static int poptDupArgv(int argc, const char **argv,
|
||||
static int XpoptDupArgv(int argc, const char **argv,
|
||||
int * argcPtr, const char *** argvPtr)
|
||||
/*@modifies *argcPtr, *argvPtr @*/
|
||||
{
|
||||
|
@ -1560,7 +1560,7 @@ static int poptDupArgv(int argc, const char **argv,
|
|||
/*@=boundswrite@*/
|
||||
|
||||
/*@-bounds@*/
|
||||
static int poptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr)
|
||||
static int XpoptParseArgvString(const char * s, int * argcPtr, const char *** argvPtr)
|
||||
/*@modifies *argcPtr, *argvPtr @*/
|
||||
{
|
||||
const char * src;
|
||||
|
@ -1620,7 +1620,7 @@ static int poptParseArgvString(const char * s, int * argcPtr, const char *** arg
|
|||
argc++, buf++;
|
||||
}
|
||||
|
||||
rc = poptDupArgv(argc, argv, argcPtr, argvPtr);
|
||||
rc = XpoptDupArgv(argc, argv, argcPtr, argvPtr);
|
||||
|
||||
exit:
|
||||
if (argv) free(argv);
|
||||
|
@ -1642,7 +1642,7 @@ int rpmGlob(const char * patterns, int * argcPtr, const char *** argvPtr)
|
|||
int i, j;
|
||||
int rc;
|
||||
|
||||
rc = poptParseArgvString(patterns, &ac, &av);
|
||||
rc = XpoptParseArgvString(patterns, &ac, &av);
|
||||
if (rc)
|
||||
return rc;
|
||||
|
||||
|
|
|
@ -69,7 +69,9 @@ rpmlua rpmluaNew()
|
|||
|
||||
lua->L = L;
|
||||
for (; lib->name; lib++) {
|
||||
/*@-noeffectuncon@*/
|
||||
(void) lib->func(L);
|
||||
/*@=noeffectuncon@*/
|
||||
lua_settop(L, 0);
|
||||
}
|
||||
lua_pushliteral(L, "LUA_PATH");
|
||||
|
|
|
@ -42,10 +42,12 @@ struct rpmluav_s {
|
|||
typedef /*@abstract@*/ struct rpmlua_s * rpmlua;
|
||||
typedef /*@abstract@*/ struct rpmluav_s * rpmluav;
|
||||
|
||||
/*@-exportlocal@*/
|
||||
/*@only@*/
|
||||
rpmlua rpmluaNew(void)
|
||||
/*@globals fileSystem @*/
|
||||
/*@modifies fileSystem @*/;
|
||||
/*@=exportlocal@*/
|
||||
void *rpmluaFree(/*@only@*/ rpmlua lua)
|
||||
/*@modifies lua @*/;
|
||||
|
||||
|
@ -105,7 +107,7 @@ void rpmluaPop(/*@null@*/ rpmlua lua)
|
|||
/*@only@*/
|
||||
rpmluav rpmluavNew(void)
|
||||
/*@*/;
|
||||
void *rpmluavFree(/*@only@*/ rpmluav var)
|
||||
void * rpmluavFree(/*@only@*/ rpmluav var)
|
||||
/*@modifes var @*/;
|
||||
void rpmluavSetListMode(rpmluav var, int flag)
|
||||
/*@modifies var @*/;
|
||||
|
|
Loading…
Reference in New Issue