- stable sort for policy specifications, patterns before paths.
- set "rpm_script_t" exec type for scriptlets iff /bin/sh, else default.
- force FD_CLOEXEC on 1st 100 inherited fdno's.
+ - serialize rpmtsRun() using fcntl on /var/lock/rpm/transaction.
4.2.1 -> 4.2.2:
- unify signal handling in librpmio, use condvar to deliver signal.
} else
fn = rpmGenPath(buildURL, NULL, fn);
+/*@-branchstate@*/
switch (tag) {
default:
rpmError(RPMERR_BADSPEC, _("%s: can't load unknown tag (%d).\n"),
fn, tag);
goto exit;
- /*@notreached@*/
+ /*@notreached@*/ break;
case RPMTAG_PUBKEYS:
if ((rc = pgpReadPkts(fn, &pkt, &pktlen)) <= 0) {
rpmError(RPMERR_BADSPEC, _("%s: public key read failed.\n"), fn);
pkt = NULL;
break;
}
+/*@=branchstate@*/
xx = headerAddOrAppendEntry(pkg->header, tag,
RPM_STRING_ARRAY_TYPE, &apkt, 1);
int dc = dnlCount(dnli);
int rc = 0;
int i;
+/*@-compdef@*/
rpmts ts = fsmGetTs(fsm);
+/*@=compdef@*/
rpmsx sx = rpmtsREContext(ts);
fsm->path = NULL;
typedef struct {
int fd;
int openmode;
-} rpmlock;
+} * rpmlock;
-static rpmlock *rpmlock_new(const char *rootdir)
+/*@null@*/
+static rpmlock rpmlock_new(const char *rootdir)
+ /*@globals fileSystem @*/
+ /*@modifies fileSystem @*/
{
- rpmlock *lock = (rpmlock *)malloc(sizeof(rpmlock));
+ rpmlock lock = (rpmlock) malloc(sizeof(*lock));
if (lock) {
mode_t oldmask = umask(022);
char *path = (char *)malloc(strlen(rootdir)+
- strlen(RPMLOCK_FILE)+2);
+ sizeof(RPMLOCK_FILE)+1);
if (!path) {
free(lock);
return NULL;
}
sprintf(path, "%s/%s", rootdir, RPMLOCK_FILE);
lock->fd = open(RPMLOCK_FILE, O_RDWR|O_CREAT, 0644);
- umask(oldmask);
+ (void) umask(oldmask);
+
+/*@-branchstate@*/
if (lock->fd == -1) {
lock->fd = open(RPMLOCK_FILE, O_RDONLY);
if (lock->fd == -1) {
} else {
lock->openmode = RPMLOCK_WRITE | RPMLOCK_READ;
}
+/*@=branchstate@*/
}
+/*@-compdef@*/
return lock;
+/*@=compdef@*/
}
-static void rpmlock_free(rpmlock *lock)
+static void rpmlock_free(/*@only@*/ /*@null@*/ rpmlock lock)
+ /*@globals fileSystem, internalState @*/
+ /*@modifies lock, fileSystem, internalState @*/
{
if (lock) {
- close(lock->fd);
+ (void) close(lock->fd);
free(lock);
}
}
-static int rpmlock_acquire(rpmlock *lock, int mode)
+static int rpmlock_acquire(/*@null@*/ rpmlock lock, int mode)
+ /*@*/
{
int res = 0;
if (lock && (mode & lock->openmode)) {
info.l_whence = SEEK_SET;
info.l_start = 0;
info.l_len = 0;
+ info.l_pid = 0;
if (fcntl(lock->fd, cmd, &info) != -1)
res = 1;
}
return res;
}
-static void rpmlock_release(rpmlock *lock)
+static void rpmlock_release(/*@null@*/ rpmlock lock)
+ /*@globals internalState @*/
+ /*@modifies internalState @*/
{
if (lock) {
struct flock info;
info.l_whence = SEEK_SET;
info.l_start = 0;
info.l_len = 0;
- fcntl(lock->fd, F_SETLK, &info);
+ info.l_pid = 0;
+ (void) fcntl(lock->fd, F_SETLK, &info);
}
}
void *rpmtsAcquireLock(rpmts ts)
{
const char *rootDir = rpmtsRootDir(ts);
- rpmlock *lock;
+ rpmlock lock;
+
if (!rootDir)
rootDir = "/";
lock = rpmlock_new(rootDir);
+/*@-branchstate@*/
if (!lock) {
rpmMessage(RPMMESS_ERROR, _("can't create transaction lock\n"));
} else if (!rpmlock_acquire(lock, RPMLOCK_WRITE)) {
lock = NULL;
}
}
+/*@=branchstate@*/
return lock;
}
void rpmtsFreeLock(void *lock)
{
- rpmlock_release((rpmlock *)lock); /* Not really needed here. */
- rpmlock_free((rpmlock *)lock);
+ rpmlock_release((rpmlock)lock); /* Not really needed here. */
+ rpmlock_free((rpmlock)lock);
}
#ifndef RPMLOCK_H
#define RPMLOCK_H
-void *rpmtsAcquireLock(rpmts ts);
-void rpmtsFreeLock(void *lock);
+/*@only@*/ /*@null@*/
+void * rpmtsAcquireLock(rpmts ts)
+ /*@globals fileSystem, internalState @*/
+ /*@modifies fileSystem, internalState @*/;
+void rpmtsFreeLock(/*@only@*/ /*@null@*/ void *lock)
+ /*@globals fileSystem, internalState @*/
+ /*@modifies lock, fileSystem, internalState @*/;
#endif
int i, j;
/* Stable sort for policy regex's and paths. */
- sxp = xmalloc(sizeof(*sxp) * sx->Count);
+ sxp = xcalloc(sx->Count, sizeof(*sxp));
/* Regex patterns first ... */
j = 0;
rpmtsi qi; rpmte q;
int numAdded;
int numRemoved;
+ void * lock;
int xx;
/* XXX programmer error segfault avoidance. */
if (rpmtsNElements(ts) <= 0)
return -1;
- void *lock = rpmtsAcquireLock(ts);
- if (!lock)
- return -1;
+ lock = rpmtsAcquireLock(ts);
+ if (lock == NULL)
+ return -1; /* XXX W2DO? */
if (rpmtsFlags(ts) & RPMTRANS_FLAG_NOSCRIPTS)
(void) rpmtsSetFlags(ts, (rpmtsFlags(ts) | _noTransScripts | _noTransTriggers));
#define POPT_WCHAR_HACK
#ifdef POPT_WCHAR_HACK
#include <wchar.h> /* for mbsrtowcs */
+/*@access mbstate_t @*/
#endif
#include "poptint.h"
mbstate_t t;
size_t n;
- memset (&t, '\0', sizeof (t)); /* In initial state. */
+ memset ((void *)&t, '\0', sizeof (t)); /* In initial state. */
/* Determine number of characters. */
n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
- displaypad = (lelen-n);
+ displaypad = (int) (lelen-n);
}
#endif
}
while (ch > (help + 1) && isspace(*ch)) ch--;
ch++;
- sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), indentLength);
+ sprintf(format, "%%.%ds\n%%%ds", (int) (ch - help), (int) indentLength);
/*@-formatconst@*/
fprintf(fp, format, help, " ");
/*@=formatconst@*/
mbstate_t t;
size_t n;
- memset (&t, '\0', sizeof (t)); /* In initial state. */
+/*@-boundswrite@*/
+ memset ((void *)&t, '\0', sizeof (t)); /* In initial state. */
+/*@=boundswrite@*/
/* Determine number of characters. */
n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
len += sizeof("=")-1 + n;
mbstate_t t;
size_t n;
- memset (&t, '\0', sizeof (t)); /* In initial state. */
+/*@-boundswrite@*/
+ memset ((void *)&t, '\0', sizeof (t)); /* In initial state. */
+/*@=boundswrite@*/
/* Determine number of characters. */
n = mbsrtowcs (NULL, &scopy, strlen(scopy), &t);
len += sizeof("=")-1 + n;
%{__includedir}/popt.h
%changelog
+* Wed Feb 25 2004 Jeff Johnson <jbj@jbj.org> 4.3-0.15
+- serialize rpmtsRun() using fcntl on /var/lock/rpm/transaction.
+
* Sun Feb 22 2004 Jeff Johnson <jbj@jbj.org> 4.3-0.14
- add ia32e arch.
- stable sort for policy specifications, patterns before paths.