summaryrefslogtreecommitdiff
path: root/rpmio
diff options
context:
space:
mode:
authorjbj <devnull@localhost>2001-04-30 22:32:22 +0000
committerjbj <devnull@localhost>2001-04-30 22:32:22 +0000
commit0ecdbba93587408c670124e88d39451c681a77eb (patch)
tree0953710c0f014faf772aa6c1ab0fdc1933ffdd8c /rpmio
parenta57a13b1350ff1a094c202c90391f8676f487582 (diff)
downloadlibrpm-tizen-0ecdbba93587408c670124e88d39451c681a77eb.tar.gz
librpm-tizen-0ecdbba93587408c670124e88d39451c681a77eb.tar.bz2
librpm-tizen-0ecdbba93587408c670124e88d39451c681a77eb.zip
- yet more boring lclint annotations and fiddles.
CVS patchset: 4732 CVS date: 2001/04/30 22:32:22
Diffstat (limited to 'rpmio')
-rw-r--r--rpmio/.lclintrc18
-rw-r--r--rpmio/digest.c4
-rw-r--r--rpmio/macro.c52
-rw-r--r--rpmio/rpmio.c127
-rw-r--r--rpmio/rpmio_api.c3
-rw-r--r--rpmio/rpmio_internal.h4
-rw-r--r--rpmio/rpmlog.c6
-rw-r--r--rpmio/rpmrpc.c126
-rw-r--r--rpmio/url.c23
9 files changed, 222 insertions, 141 deletions
diff --git a/rpmio/.lclintrc b/rpmio/.lclintrc
index 5da960259..0d1f2d9de 100644
--- a/rpmio/.lclintrc
+++ b/rpmio/.lclintrc
@@ -12,21 +12,15 @@
# don't-bother-me-yet parameters
-branchstate # ~43 occurences
-#-immediatetrans
--mustfree # alloca is painful
-#-observertrans
-#-statictrans
+-mustfree # ~122 alloca is painful
# not-yet normal parameters
--boolops # w->n
-#-fixedformalarray
--null # ugh
--predboolint # w->n ~144
-#-predboolothers # w->n ~8
--retvalint # w->n ~48
--type # ~449
+-boolops # ~244 w->n
+#-null # ~84
+-predboolint # ~147 w->n
+-type # ~373
-# not-yet -weak paramaters
+# -weak paramaters
#+boolint
#-boolops
#+ignorequals
diff --git a/rpmio/digest.c b/rpmio/digest.c
index 8fa83dea4..461aebd47 100644
--- a/rpmio/digest.c
+++ b/rpmio/digest.c
@@ -453,14 +453,18 @@ rpmDigestUpdate(DIGEST_CTX ctx, const void * data, size_t len)
/* Process data in ctx->datalen chunks */
for (; len >= ctx->datalen; buf += ctx->datalen, len -= ctx->datalen) {
+ /*@-mayaliasunique@*/
memcpy(ctx->in, buf, ctx->datalen);
+ /*@=mayaliasunique@*/
if (ctx->doByteReverse)
byteReverse(ctx->in, ctx->datalen);
ctx->transform(ctx);
}
/* Handle any remaining bytes of data. */
+ /*@-mayaliasunique@*/
memcpy(ctx->in, buf, len);
+ /*@=mayaliasunique@*/
}
void
diff --git a/rpmio/macro.c b/rpmio/macro.c
index 9fb896507..e74698a64 100644
--- a/rpmio/macro.c
+++ b/rpmio/macro.c
@@ -214,7 +214,9 @@ findEntry(MacroContext *mc, const char *name, size_t namelen)
key = &keybuf;
memset(key, 0, sizeof(*key));
+ /*@-temptrans@*/
key->name = (char *)name;
+ /*@=temptrans@*/
ret = (MacroEntry **)bsearch(&key, mc->macroTable, mc->firstFree,
sizeof(*(mc->macroTable)), compareMacroName);
/* XXX TODO: find 1st empty slot and return that */
@@ -466,7 +468,9 @@ expandU(MacroBuf *mb, char *u, size_t ulen)
tbuf = alloca(ulen + 1);
memset(tbuf, 0, (ulen + 1));
+ /*@-temptrans@*/
mb->s = u;
+ /*@=temptrans@*/
mb->t = tbuf;
mb->nb = ulen;
rc = expandMacro(mb);
@@ -507,7 +511,7 @@ doShellEscape(MacroBuf *mb, const char *cmd, size_t clen)
return 1;
while(mb->nb > 0 && (c = fgetc(shf)) != EOF)
SAVECHAR(mb, c);
- pclose(shf);
+ (void) pclose(shf);
/* XXX delete trailing \r \n */
while (iseol(mb->t[-1])) {
@@ -686,11 +690,13 @@ popMacro(MacroEntry **mep)
if (me) {
/* XXX cast to workaround const */
+ /*@-onlytrans@*/
if ((*mep = me->prev) == NULL)
FREE(me->name);
FREE(me->opts);
FREE(me->body);
FREE(me);
+ /*@=onlytrans@*/
}
}
@@ -817,7 +823,7 @@ grabArgs(MacroBuf *mb, const MacroEntry *me, const char *se, char lastc)
while((c = getopt(argc, (char **)argv, opts)) != -1) {
if (c == '?' || (o = strchr(opts, c)) == NULL) {
rpmError(RPMERR_BADSPEC, _("Unknown option %c in %s(%s)\n"),
- c, me->name, opts);
+ (char)c, me->name, opts);
return se;
}
*be++ = '-';
@@ -869,7 +875,7 @@ doOutput(MacroBuf *mb, int waserror, const char *msg, size_t msglen)
strncpy(buf, msg, msglen);
buf[msglen] = '\0';
- expandU(mb, buf, sizeof(buf));
+ (void) expandU(mb, buf, sizeof(buf));
if (waserror)
rpmError(RPMERR_BADSPEC, "%s\n", buf);
else
@@ -895,7 +901,7 @@ doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t
if (g) {
strncpy(buf, g, glen);
buf[glen] = '\0';
- expandU(mb, buf, sizeof(buf));
+ (void) expandU(mb, buf, sizeof(buf));
}
if (STREQ("basename", f, fn)) {
if ((b = strrchr(buf, '/')) == NULL)
@@ -928,7 +934,7 @@ doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t
be++;
*be++ = '\0';
#ifndef DEBUG_MACROS
- isCompressed(b, &compressed);
+ (void) isCompressed(b, &compressed);
#endif
switch(compressed) {
default:
@@ -968,7 +974,7 @@ doFoo(MacroBuf *mb, int negate, const char *f, size_t fn, const char *g, size_t
}
if (b) {
- expandT(mb, b, strlen(b));
+ (void) expandT(mb, b, strlen(b));
}
}
@@ -1063,7 +1069,7 @@ expandMacro(MacroBuf *mb)
case '(': /* %(...) shell escape */
if ((se = matchchar(s, c, ')')) == NULL) {
rpmError(RPMERR_BADSPEC,
- _("Unterminated %c: %s\n"), c, s);
+ _("Unterminated %c: %s\n"), (char)c, s);
rc = 1;
continue;
}
@@ -1080,7 +1086,7 @@ expandMacro(MacroBuf *mb)
case '{': /* %{...}/%{...:...} substitution */
if ((se = matchchar(s, c, '}')) == NULL) {
rpmError(RPMERR_BADSPEC,
- _("Unterminated %c: %s\n"), c, s);
+ _("Unterminated %c: %s\n"), (char)c, s);
rc = 1;
continue;
}
@@ -1268,7 +1274,9 @@ expandMacro(MacroBuf *mb)
/* Recursively expand body of macro */
if (me->body && *me->body) {
+ /*@-onlytrans@*/
mb->s = me->body;
+ /*@=onlytrans@*/
rc = expandMacro(mb);
if (rc == 0)
me->used++; /* Mark macro as used */
@@ -1306,15 +1314,19 @@ expandMacros(void *spec, MacroContext *mc, char *s, size_t slen)
tbuf = alloca(slen + 1);
memset(tbuf, 0, (slen + 1));
+ /*@-temptrans@*/
mb->s = s;
+ /*@=temptrans@*/
mb->t = tbuf;
mb->nb = slen;
mb->depth = 0;
mb->macro_trace = print_macro_trace;
mb->expand_trace = print_expand_trace;
+ /*@-temptrans@*/
mb->spec = spec; /* (future) %file expansion info */
mb->mc = mc;
+ /*@=temptrans@*/
rc = expandMacro(mb);
@@ -1373,7 +1385,9 @@ rpmDefineMacro(MacroContext *mc, const char *macro, int level)
memset(mb, 0, sizeof(*mb));
/* XXX just enough to get by */
+ /*@-temptrans@*/
mb->mc = (mc ? mc : &rpmGlobalMacroContext);
+ /*@=temptrans@*/
(void)doDefine(mb, macro, level, 0);
return 0;
}
@@ -1436,7 +1450,7 @@ rpmInitMacros(MacroContext *mc, const char *macrofiles)
fd = Fopen(buf, "r.fpio");
if (fd == NULL || Ferror(fd)) {
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
continue;
}
@@ -1454,15 +1468,18 @@ rpmInitMacros(MacroContext *mc, const char *macrofiles)
n++; /* skip % */
(void)rpmDefineMacro(NULL, n, RMIL_MACROFILES);
}
- Fclose(fd);
+ (void) Fclose(fd);
}
- if (m)
+ if (m) {
free(m);
+ m = NULL;
+ }
/* Reload cmdline macros */
rpmLoadMacros(&rpmCLIMacroContext, RMIL_CMDLINE);
}
+/*@-globstate@*/
void
rpmFreeMacros(MacroContext *mc)
{
@@ -1475,8 +1492,10 @@ rpmFreeMacros(MacroContext *mc)
MacroEntry *me;
while ((me = mc->macroTable[i]) != NULL) {
/* XXX cast to workaround const */
+ /*@-onlytrans@*/
if ((mc->macroTable[i] = me->prev) == NULL)
FREE(me->name);
+ /*@=onlytrans@*/
FREE(me->opts);
FREE(me->body);
FREE(me);
@@ -1485,6 +1504,7 @@ rpmFreeMacros(MacroContext *mc)
FREE(mc->macroTable);
memset(mc, 0, sizeof(*mc));
}
+/*@=globstate@*/
/* =============================================================== */
int isCompressed(const char *file, rpmCompressedMagic *compressed)
@@ -1500,7 +1520,7 @@ int isCompressed(const char *file, rpmCompressedMagic *compressed)
if (fd == NULL || Ferror(fd)) {
/* XXX Fstrerror */
rpmError(RPMERR_BADSPEC, _("File %s: %s\n"), file, Fstrerror(fd));
- if (fd) Fclose(fd);
+ if (fd) (void) Fclose(fd);
return 1;
}
nb = Fread(magic, sizeof(char), sizeof(magic), fd);
@@ -1512,7 +1532,7 @@ int isCompressed(const char *file, rpmCompressedMagic *compressed)
file, (unsigned)sizeof(magic));
rc = 0;
}
- Fclose(fd);
+ (void) Fclose(fd);
if (rc >= 0)
return rc;
@@ -1555,7 +1575,7 @@ rpmExpand(const char *arg, ...)
while ((s = va_arg(ap, const char *)) != NULL)
pe = stpcpy(pe, s);
va_end(ap);
- expandMacros(NULL, NULL, buf, sizeof(buf));
+ (void) expandMacros(NULL, NULL, buf, sizeof(buf));
return xstrdup(buf);
}
@@ -1661,7 +1681,7 @@ char *rpmCleanPath(char * path)
*t = '\0';
/*fprintf(stderr, "\t%s\n", path); */
- return path;
+ /*@-temptrans@*/ return path; /*@=temptrans@*/
}
/* Return concatenated and expanded canonical path. */
@@ -1688,7 +1708,7 @@ rpmGetPath(const char *path, ...)
*te = '\0';
}
va_end(ap);
- expandMacros(NULL, NULL, buf, sizeof(buf));
+ (void) expandMacros(NULL, NULL, buf, sizeof(buf));
(void) rpmCleanPath(buf);
return xstrdup(buf); /* XXX xstrdup has side effects. */
diff --git a/rpmio/rpmio.c b/rpmio/rpmio.c
index d9b5606a5..63ecd2441 100644
--- a/rpmio/rpmio.c
+++ b/rpmio/rpmio.c
@@ -278,7 +278,7 @@ static inline /*@null@*/ FD_t XfdNew(const char *msg, const char *file, unsigned
fd->errcookie = NULL;
fd->stats = xcalloc(1, sizeof(*fd->stats));
fd->digest = NULL;
- gettimeofday(&fd->stats->create, NULL);
+ (void) gettimeofday(&fd->stats->create, NULL);
fd->stats->begin = fd->stats->create; /* structure assignment */
fd->ftpFileDoneNeeded = 0;
@@ -352,7 +352,7 @@ static inline int fdSeek(void * cookie, _libio_pos_t pos, int whence) {
rc = lseek(fdFileno(fd), p, whence);
fdstat_exit(fd, FDSTAT_SEEK, rc);
-DBGIO(fd, (stderr, "==>\tfdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (long)rc, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tfdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (unsigned long)rc, fdbg(fd)));
return rc;
}
@@ -372,7 +372,7 @@ int fdClose( /*@only@*/ void * cookie) {
rc = ((fdno >= 0) ? close(fdno) : -2);
fdstat_exit(fd, FDSTAT_CLOSE, rc);
-DBGIO(fd, (stderr, "==>\tfdClose(%p) rc %lx %s\n", fd, (long)rc, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tfdClose(%p) rc %lx %s\n", fd, (unsigned long)rc, fdbg(fd)));
fd = fdFree(fd, "open (fdClose)");
return rc;
@@ -387,7 +387,7 @@ DBGIO(fd, (stderr, "==>\tfdClose(%p) rc %lx %s\n", fd, (long)rc, fdbg(fd)));
fd = fdNew("open (fdOpen)");
fdSetFdno(fd, fdno);
fd->flags = flags;
-DBGIO(fd, (stderr, "==>\tfdOpen(\"%s\",%x,0%o) %s\n", path, flags, (unsigned)mode, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tfdOpen(\"%s\",%x,0%o) %s\n", path, (unsigned)flags, (unsigned)mode, fdbg(fd)));
/*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
}
@@ -418,7 +418,9 @@ int fdWritable(FD_t fd, int secs)
tvp->tv_usec = 0;
}
errno = 0;
+ /*@-compdef@*/
rc = select(fdno + 1, NULL, &wrfds, NULL, tvp);
+ /*@=compdef@*/
if (_rpmio_debug && !(rc == 1 && errno == 0))
fprintf(stderr, "*** fdWritable fdno %d rc %d %s\n", fdno, rc, strerror(errno));
@@ -456,7 +458,9 @@ int fdReadable(FD_t fd, int secs)
tvp->tv_usec = 0;
}
errno = 0;
+ /*@-compdef@*/
rc = select(fdno + 1, &rdfds, NULL, NULL, tvp);
+ /*@=compdef@*/
if (rc < 0) {
switch (errno) {
@@ -619,25 +623,25 @@ static int mygethostbyname(const char * host, struct in_addr * address)
static int getHostAddress(const char * host, struct in_addr * address)
{
if (xisdigit(host[0])) {
- if (! /*@-unrecog@*/ inet_aton(host, address) /*@=unrecog@*/ ) {
- return FTPERR_BAD_HOST_ADDR;
- }
+ if (! /*@-unrecog@*/ inet_aton(host, address) /*@=unrecog@*/ )
+ return FTPERR_BAD_HOST_ADDR;
} else {
- if (mygethostbyname(host, address)) {
- errno = h_errno;
- return FTPERR_BAD_HOSTNAME;
- }
+ if (mygethostbyname(host, address)) {
+ errno = /*@-unrecog@*/ h_errno /*@=unrecog@*/;
+ return FTPERR_BAD_HOSTNAME;
+ }
}
return 0;
}
-static int tcpConnect(FD_t ctrl, const char *host, int port)
+static int tcpConnect(FD_t ctrl, const char * host, int port)
{
struct sockaddr_in sin;
int fdno = -1;
int rc;
+ memset(&sin, 0, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_port = htons(port);
sin.sin_addr.s_addr = INADDR_ANY;
@@ -669,9 +673,11 @@ ntohs(sin.sin_port), fdno);
return 0;
errxit:
+ /*@-observertrans@*/
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
+ /*@=observertrans@*/
if (fdno >= 0)
- close(fdno);
+ (void) close(fdno);
return rc;
}
@@ -929,8 +935,9 @@ static int ftpLogin(urlinfo u)
}
if (fdFileno(u->ctrl) >= 0 && fdWritable(u->ctrl, 0) < 1)
- fdClose(u->ctrl);
+ /*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/
+/*@-usereleased@*/
if (fdFileno(u->ctrl) < 0) {
rc = tcpConnect(u->ctrl, host, port);
if (rc < 0)
@@ -949,14 +956,21 @@ static int ftpLogin(urlinfo u)
if ((rc = ftpCommand(u, NULL, "TYPE", "I", NULL)))
goto errxit;
+ /*@-compdef@*/
return 0;
+ /*@=compdef@*/
errxit:
+ /*@-observertrans@*/
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
+ /*@=observertrans@*/
errxit2:
if (fdFileno(u->ctrl) >= 0)
- fdClose(u->ctrl);
+ /*@-refcounttrans@*/ (void) fdClose(u->ctrl); /*@=refcounttrans@*/
+ /*@-compdef@*/
return rc;
+ /*@=compdef@*/
+/*@=usereleased@*/
}
int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg)
@@ -1028,6 +1042,7 @@ int ftpReq(FD_t data, const char * ftpCmd, const char * ftpArg)
port number portion */
{ int i, j;
+ memset(&dataAddress, 0, sizeof(dataAddress));
dataAddress.sin_family = AF_INET;
if (sscanf(chptr, "%d,%d", &i, &j) != 2) {
rc = FTPERR_PASSIVE_ERROR;
@@ -1083,9 +1098,11 @@ fprintf(stderr, "-> %s", cmd);
return 0;
errxit:
+ /*@-observertrans@*/
fdSetSyserrno(u->ctrl, errno, ftpStrerror(rc));
+ /*@=observertrans@*/
if (fdFileno(data) >= 0)
- fdClose(data);
+ /*@-refcounttrans@*/ (void) fdClose(data); /*@=refcounttrans@*/
return rc;
}
@@ -1200,7 +1217,7 @@ int ufdGetFile(FD_t sfd, FD_t tfd)
FDSANE(sfd);
FDSANE(tfd);
rc = ufdCopy(sfd, tfd);
- Fclose(sfd);
+ (void) Fclose(sfd);
if (rc > 0) /* XXX ufdCopy now returns no. bytes copied */
rc = 0;
return rc;
@@ -1253,14 +1270,15 @@ static int ftpAbort(urlinfo u, FD_t data) {
DBGIO(0, (stderr, "-> ABOR\n"));
+/*@-usereleased -compdef@*/
if (send(fdFileno(ctrl), ipbuf, sizeof(ipbuf), MSG_OOB) != sizeof(ipbuf)) {
- fdClose(ctrl);
+ /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
return FTPERR_SERVER_IO_ERROR;
}
sprintf(u->buf, "%cABOR\r\n",(char) DM);
if (fdWrite(ctrl, u->buf, 7) != 7) {
- fdClose(ctrl);
+ /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
return FTPERR_SERVER_IO_ERROR;
}
@@ -1274,8 +1292,8 @@ static int ftpAbort(urlinfo u, FD_t data) {
}
data->rd_timeoutsecs = tosecs;
/* XXX ftp abort needs to close the data channel to receive status */
- shutdown(fdFileno(data), SHUT_RDWR);
- close(fdFileno(data));
+ (void) shutdown(fdFileno(data), SHUT_RDWR);
+ (void) close(fdFileno(data));
data->fps[0].fdno = -1; /* XXX WRONG but expedient */
}
@@ -1289,6 +1307,7 @@ static int ftpAbort(urlinfo u, FD_t data) {
u->ctrl->rd_timeoutsecs = tosecs;
return rc;
+/*@=usereleased =compdef@*/
}
static int ftpFileDone(urlinfo u, FD_t data)
@@ -1351,9 +1370,10 @@ static int httpReq(FD_t ctrl, const char * httpCmd, const char * httpArg)
reopen:
if (fdFileno(ctrl) >= 0 && (rc = fdWritable(ctrl, 0)) < 1) {
- fdClose(ctrl);
+ /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
}
+/*@-usereleased@*/
if (fdFileno(ctrl) < 0) {
rc = tcpConnect(ctrl, host, port);
if (rc < 0)
@@ -1410,7 +1430,7 @@ fprintf(stderr, "-> %s", req);
if (rc) {
if (!retrying) { /* not HTTP_OK */
retrying = 1;
- fdClose(ctrl);
+ /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
goto reopen;
}
goto errxit;
@@ -1421,11 +1441,14 @@ fprintf(stderr, "-> %s", req);
return 0;
errxit:
+ /*@-observertrans@*/
fdSetSyserrno(ctrl, errno, ftpStrerror(rc));
+ /*@=observertrans@*/
errxit2:
if (fdFileno(ctrl) >= 0)
- fdClose(ctrl);
+ /*@-refcounttrans@*/ (void) fdClose(ctrl); /*@=refcounttrans@*/
return rc;
+/*@=usereleased@*/
}
/* XXX DYING: unused */
@@ -1446,7 +1469,7 @@ static ssize_t ufdRead(void * cookie, /*@out@*/ char * buf, size_t count) {
if (fdGetIo(fd) == fdio) {
struct stat sb;
int fdno = fdFileno(fd);
- fstat(fdno, &sb);
+ (void) fstat(fdno, &sb);
if (S_ISREG(sb.st_mode))
return fdRead(fd, buf, count);
}
@@ -1506,7 +1529,7 @@ static ssize_t ufdWrite(void * cookie, const char * buf, size_t count)
#ifdef NOTYET
if (fdGetIo(fd) == fdio) {
struct stat sb;
- fstat(fdGetFdno(fd), &sb);
+ (void) fstat(fdGetFdno(fd), &sb);
if (S_ISREG(sb.st_mode))
return fdWrite(fd, buf, count);
}
@@ -1624,9 +1647,9 @@ int ufdClose( /*@only@*/ void * cookie)
if (fd->bytesRemain > 0) {
if (fd->ftpFileDoneNeeded) {
if (fdReadable(u->ctrl, 0) > 0)
- ftpFileDone(u, fd);
+ (void) ftpFileDone(u, fd);
else
- ftpAbort(u, fd);
+ (void) ftpAbort(u, fd);
}
} else {
int rc;
@@ -1636,7 +1659,7 @@ int ufdClose( /*@only@*/ void * cookie)
assert(fd->ftpFileDoneNeeded != 0);
#endif
if (fd->ftpFileDoneNeeded)
- ftpFileDone(u, fd);
+ (void) ftpFileDone(u, fd);
return rc;
}
}
@@ -1726,8 +1749,8 @@ exit:
return fd;
}
-static /*@null@*/ FD_t httpOpen(const char *url, int flags, mode_t mode,
- /*@out@*/ urlinfo *uret)
+static /*@null@*/ FD_t httpOpen(const char * url, /*@unused@*/ int flags,
+ /*@unused@*/ mode_t mode, /*@out@*/ urlinfo * uret)
{
urlinfo u = NULL;
FD_t fd = NULL;
@@ -1775,7 +1798,7 @@ static /*@null@*/ FD_t ufdOpen(const char *url, int flags, mode_t mode)
urltype urlType = urlPath(url, &path);
if (_rpmio_debug)
-fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, flags, (unsigned)mode);
+fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, (unsigned)flags, (unsigned)mode);
switch (urlType) {
case URL_IS_FTP:
@@ -1843,10 +1866,10 @@ fprintf(stderr, "*** ufdOpen(%s,0x%x,0%o)\n", url, flags, (unsigned)mode);
if (fd == NULL) return NULL;
fd->urlType = urlType;
if (Fileno(fd) < 0) {
- ufdClose(fd);
+ (void) ufdClose(fd);
return NULL;
}
-DBGIO(fd, (stderr, "==>\tufdOpen(\"%s\",%x,0%o) %s\n", url, flags, (unsigned)mode, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tufdOpen(\"%s\",%x,0%o) %s\n", url, (unsigned)flags, (unsigned)mode, fdbg(fd)));
return fd;
}
@@ -1922,7 +1945,7 @@ static ssize_t gzdRead(void * cookie, /*@out@*/ char * buf, size_t count) {
gzfile = gzdFileno(fd);
fdstat_enter(fd, FDSTAT_READ);
rc = gzread(gzfile, buf, count);
-DBGIO(fd, (stderr, "==>\tgzdRead(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (long)rc, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tgzdRead(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (unsigned long)rc, fdbg(fd)));
if (rc < 0) {
int zerror = 0;
fd->errcookie = gzerror(gzfile, &zerror);
@@ -1949,7 +1972,7 @@ static ssize_t gzdWrite(void * cookie, const char * buf, size_t count) {
gzfile = gzdFileno(fd);
fdstat_enter(fd, FDSTAT_WRITE);
rc = gzwrite(gzfile, (void *)buf, count);
-DBGIO(fd, (stderr, "==>\tgzdWrite(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (long)rc, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tgzdWrite(%p,%p,%u) rc %lx %s\n", cookie, buf, (unsigned)count, (unsigned long)rc, fdbg(fd)));
if (rc < 0) {
int zerror = 0;
fd->errcookie = gzerror(gzfile, &zerror);
@@ -1979,7 +2002,7 @@ static inline int gzdSeek(void * cookie, _libio_pos_t pos, int whence) {
gzfile = gzdFileno(fd);
fdstat_enter(fd, FDSTAT_SEEK);
rc = gzseek(gzfile, p, whence);
-DBGIO(fd, (stderr, "==>\tgzdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (long)rc, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tgzdSeek(%p,%ld,%d) rc %lx %s\n", cookie, (long)p, whence, (unsigned long)rc, fdbg(fd)));
if (rc < 0) {
int zerror = 0;
fd->errcookie = gzerror(gzfile, &zerror);
@@ -2022,7 +2045,7 @@ DBGIO(fd, (stderr, "==>\tgzdClose(%p) zerror %d %s\n", cookie, rc, fdbg(fd)));
}
}
-DBGIO(fd, (stderr, "==>\tgzdClose(%p) rc %lx %s\n", cookie, (long)rc, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tgzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, fdbg(fd)));
if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "GZDIO", stderr);
if (rc == 0)
@@ -2174,7 +2197,7 @@ static int bzdClose( /*@only@*/ void * cookie) {
}
}
-DBGIO(fd, (stderr, "==>\tbzdClose(%p) rc %lx %s\n", cookie, (long)rc, fdbg(fd)));
+DBGIO(fd, (stderr, "==>\tbzdClose(%p) rc %lx %s\n", cookie, (unsigned long)rc, fdbg(fd)));
if (_rpmio_debug || rpmIsDebug()) fdstat_print(fd, "BZDIO", stderr);
if (rc == 0)
@@ -2322,9 +2345,12 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", fd, fdbg(fd)));
fd->fps[fd->nfps-1].fp == fp &&
fd->fps[fd->nfps-1].fdno >= 0)
{
- fflush(fp);
+ (void) fflush(fp);
fd->nfps--;
+ /*@-refcounttrans@*/
rc = ufdClose(fd);
+ /*@=refcounttrans@*/
+/*@-usereleased@*/
if (fdGetFdno(fd) >= 0)
break;
fdSetFp(fd, NULL);
@@ -2352,6 +2378,7 @@ DBGIO(fd, (stderr, "==> Fclose(%p) %s\n", fd, fdbg(fd)));
}
fd = fdFree(fd, "Fclose");
return ec;
+/*@=usereleased@*/
}
/*
@@ -2452,7 +2479,7 @@ fprintf(stderr, "*** Fdopen(%p,%s) %s\n", fd, fmode, fdbg(fd));
strncat(zstdio, other, sizeof(zstdio) - strlen(zstdio));
if (end == NULL && other[0] == '\0')
- return fd;
+ /*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
if (end && *end) {
if (!strcmp(end, "fdio")) {
@@ -2474,14 +2501,18 @@ fprintf(stderr, "*** Fdopen(%p,%s) %s\n", fd, fmode, fdbg(fd));
if (noLibio) {
int fdno = Fileno(fd);
FILE * fp = fdopen(fdno, stdio);
+/*@+voidabstract@*/
if (_rpmio_debug)
-fprintf(stderr, "*** Fdopen fpio fp %p\n", fp);
+fprintf(stderr, "*** Fdopen fpio fp %p\n", (void *)fp);
+/*@=voidabstract@*/
if (fp == NULL)
return NULL;
/* XXX gzdio/bzdio use fp for private data */
+ /*@+voidabstract@*/
if (fdGetFp(fd) == NULL)
fdSetFp(fd, fp);
fdPush(fd, fpio, fp, fdno); /* Push fpio onto stack */
+ /*@=voidabstract@*/
}
}
} else if (other[0] != '\0') {
@@ -2493,7 +2524,7 @@ fprintf(stderr, "*** Fdopen fpio fp %p\n", fp);
}
}
if (iof == NULL)
- return fd;
+ /*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
if (!noLibio) {
FILE * fp = NULL;
@@ -2511,15 +2542,17 @@ DBGIO(fd, (stderr, "==> fopencookie(%p,\"%s\",*%p) returns fp %p\n", fd, stdio,
if (fp) {
/* XXX gzdio/bzdio use fp for private data */
+ /*@+voidabstract@*/
if (fdGetFp(fd) == NULL)
fdSetFp(fd, fp);
fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
+ /*@=voidabstract@*/
fd = fdLink(fd, "fopencookie");
}
}
DBGIO(fd, (stderr, "==> Fdopen(%p,\"%s\") returns fd %p %s\n", ofd, fmode, fd, fdbg(fd)));
- return fd;
+ /*@-refcounttrans@*/ return fd; /*@=refcounttrans@*/
}
FD_t Fopen(const char *path, const char *fmode)
@@ -2542,7 +2575,7 @@ if (_rpmio_debug)
fprintf(stderr, "*** Fopen fdio path %s fmode %s\n", path, fmode);
fd = fdOpen(path, flags, perms);
if (fdFileno(fd) < 0) {
- fdClose(fd);
+ (void) fdClose(fd);
return NULL;
}
} else if (!strcmp(end, "fadio")) {
@@ -2550,7 +2583,7 @@ if (_rpmio_debug)
fprintf(stderr, "*** Fopen fadio path %s fmode %s\n", path, fmode);
fd = fadio->_open(path, flags, perms);
if (fdFileno(fd) < 0) {
- fdClose(fd);
+ /*@-refcounttrans@*/ (void) fdClose(fd); /*@=refcounttrans@*/
return NULL;
}
} else {
@@ -2583,7 +2616,9 @@ fprintf(stderr, "*** Fopen WTFO path %s fmode %s\n", path, fmode);
/* XXX persistent HTTP/1.1 returns the previously opened fp */
if (isHTTP && ((fp = fdGetFp(fd)) != NULL) && ((fdno = fdGetFdno(fd)) >= 0)) {
+ /*@+voidabstract@*/
fdPush(fd, fpio, fp, fileno(fp)); /* Push fpio onto stack */
+ /*@=voidabstract@*/
return fd;
}
}
diff --git a/rpmio/rpmio_api.c b/rpmio/rpmio_api.c
index af0afd3b9..a12899835 100644
--- a/rpmio/rpmio_api.c
+++ b/rpmio/rpmio_api.c
@@ -13,9 +13,12 @@
/*@access FD_t@*/
+/*@-redef@*/
+int fdFileno(void * cookie); /* Yet Another Prototype. */
int fdFileno(void * cookie) {
FD_t fd;
if (cookie == NULL) return -2;
fd = c2f(cookie);
return fd->fps[0].fdno;
}
+/*@=redef@*/
diff --git a/rpmio/rpmio_internal.h b/rpmio/rpmio_internal.h
index 52529be56..ea7585fa2 100644
--- a/rpmio/rpmio_internal.h
+++ b/rpmio/rpmio_internal.h
@@ -235,7 +235,7 @@ int ufdClose( /*@only@*/ void * cookie);
{
if (fd->stats == NULL) return;
fd->stats->ops[opx].count++;
- gettimeofday(&fd->stats->begin, NULL);
+ (void) gettimeofday(&fd->stats->begin, NULL);
}
/** \ingroup rpmio
@@ -259,7 +259,7 @@ int ufdClose( /*@only@*/ void * cookie);
struct timeval end;
if (rc == -1) fd->syserrno = errno;
if (fd->stats == NULL) return;
- gettimeofday(&end, NULL);
+ (void) gettimeofday(&end, NULL);
if (rc >= 0) {
switch(opx) {
case FDSTAT_SEEK:
diff --git a/rpmio/rpmlog.c b/rpmio/rpmlog.c
index 94e4d1ecb..a7b1318c6 100644
--- a/rpmio/rpmlog.c
+++ b/rpmio/rpmlog.c
@@ -179,10 +179,10 @@ static void vrpmlog (unsigned code, const char *fmt, va_list ap)
}
if (rpmlogMsgPrefix[pri] && *rpmlogMsgPrefix[pri])
- fputs(_(rpmlogMsgPrefix[pri]), msgout);
+ (void) fputs(_(rpmlogMsgPrefix[pri]), msgout);
- fputs(msg, msgout);
- fflush(msgout);
+ (void) fputs(msg, msgout);
+ (void) fflush(msgout);
if (freeMsgbuf)
free(msgbuf);
if (pri <= RPMLOG_CRIT)
diff --git a/rpmio/rpmrpc.c b/rpmio/rpmrpc.c
index abc297530..91a979ae4 100644
--- a/rpmio/rpmrpc.c
+++ b/rpmio/rpmrpc.c
@@ -277,79 +277,83 @@ static int
is_dos_date(char *str)
{
if (strlen(str) == 8 && str[2] == str[5] && strchr("\\-/", (int)str[2]) != NULL)
- return (1);
+ return 1;
- return (0);
+ return 0;
}
static int
-is_week (char *str, struct tm *tim)
+is_week (const char * str, /*@out@*/ struct tm * tim)
{
- static char *week = "SunMonTueWedThuFriSat";
- char *pos;
+/*@observer@*/ static const char * week = "SunMonTueWedThuFriSat";
+ const char * pos;
- if((pos=strstr(week, str)) != NULL){
- if(tim != NULL)
+ /*@-observertrans -mayaliasunique@*/
+ if ((pos=strstr(week, str)) != NULL) {
+ /*@=observertrans =mayaliasunique@*/
+ if (tim != NULL)
tim->tm_wday = (pos - week)/3;
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
static int
-is_month (char *str, struct tm *tim)
+is_month (const char * str, /*@out@*/ struct tm * tim)
{
- static char *month = "JanFebMarAprMayJunJulAugSepOctNovDec";
- char *pos;
+/*@observer@*/ static const char * month = "JanFebMarAprMayJunJulAugSepOctNovDec";
+ const char * pos;
- if((pos=strstr(month, str)) != NULL){
- if(tim != NULL)
+ /*@-observertrans -mayaliasunique@*/
+ if ((pos=strstr(month, str)) != NULL) {
+ /*@=observertrans -mayaliasunique@*/
+ if (tim != NULL)
tim->tm_mon = (pos - month)/3;
- return (1);
+ return 1;
}
- return (0);
+ return 0;
}
static int
-is_time (char *str, struct tm *tim)
+is_time (const char * str, /*@out@*/ struct tm * tim)
{
- char *p, *p2;
+ const char * p, * p2;
if ((p=strchr(str, ':')) && (p2=strrchr(str, ':'))) {
if (p != p2) {
if (sscanf (str, "%2d:%2d:%2d", &tim->tm_hour, &tim->tm_min, &tim->tm_sec) != 3)
- return (0);
+ return 0;
}
else {
if (sscanf (str, "%2d:%2d", &tim->tm_hour, &tim->tm_min) != 2)
- return (0);
+ return 0;
}
}
else
- return (0);
+ return 0;
- return (1);
+ return 1;
}
-static int is_year(char *str, struct tm *tim)
+static int is_year(const char * str, /*@out@*/ struct tm * tim)
{
long year;
if (strchr(str,':'))
- return (0);
+ return 0;
if (strlen(str)!=4)
- return (0);
+ return 0;
if (sscanf(str, "%ld", &year) != 1)
- return (0);
+ return 0;
if (year < 1900 || year > 3000)
- return (0);
+ return 0;
tim->tm_year = (int) (year - 1900);
- return (1);
+ return 1;
}
/*
@@ -361,7 +365,7 @@ static int is_year(char *str, struct tm *tim)
static int
vfs_parse_filetype (char c)
{
- switch (c){
+ switch (c) {
case 'd': return S_IFDIR;
case 'b': return S_IFBLK;
case 'c': return S_IFCHR;
@@ -377,37 +381,37 @@ vfs_parse_filetype (char c)
}
}
-static int vfs_parse_filemode (char *p)
+static int vfs_parse_filemode (const char *p)
{ /* converts rw-rw-rw- into 0666 */
int res = 0;
- switch (*(p++)){
+ switch (*(p++)) {
case 'r': res |= 0400; break;
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'w': res |= 0200; break;
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'x': res |= 0100; break;
case 's': res |= 0100 | S_ISUID; break;
case 'S': res |= S_ISUID; break;
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'r': res |= 0040; break;
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'w': res |= 0020; break;
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'x': res |= 0010; break;
case 's': res |= 0010 | S_ISGID; break;
case 'l': /* Solaris produces these */
@@ -415,17 +419,17 @@ static int vfs_parse_filemode (char *p)
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'r': res |= 0004; break;
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'w': res |= 0002; break;
case '-': break;
default: return -1;
}
- switch (*(p++)){
+ switch (*(p++)) {
case 'x': res |= 0001; break;
case 't': res |= 0001 | S_ISVTX; break;
case 'T': res |= S_ISVTX; break;
@@ -482,7 +486,8 @@ static int vfs_parse_filedate(int idx, time_t *t)
if (is_dos_date(p)){
p[2] = p[5] = '-';
- if(sscanf(p, "%2d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){
+ memset(d, 0, sizeof(d));
+ if (sscanf(p, "%2d-%2d-%2d", &d[0], &d[1], &d[2]) == 3){
/* We expect to get:
1. MM-DD-YY
2. DD-MM-YY
@@ -540,7 +545,9 @@ static int vfs_parse_filedate(int idx, time_t *t)
}
static int
-vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
+vfs_parse_ls_lga (char * p, /*@out@*/ struct stat * st,
+ /*@out@*/ const char ** filename,
+ /*@out@*/ const char ** linkname)
{
int idx, idx2, num_cols;
int i;
@@ -563,11 +570,13 @@ vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
if (strlen (p) <= 8 || p [8] != ']')
goto error;
/* Should parse here the Notwell permissions :) */
+ /*@-unrecog@*/
if (S_ISDIR (st->st_mode))
st->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR | S_IXUSR | S_IXGRP | S_IXOTH);
else
st->st_mode |= (S_IRUSR | S_IRGRP | S_IROTH | S_IWUSR);
p += 9;
+ /*@=unrecog@*/
} else {
if ((i = vfs_parse_filemode(p)) == -1)
goto error;
@@ -591,7 +600,7 @@ vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
#ifdef HACK
st->st_uid = finduid (columns [1]);
#else
- unameToUid (columns [1], &st->st_uid);
+ (void) unameToUid (columns [1], &st->st_uid);
#endif
else
st->st_uid = (uid_t) atol (columns [1]);
@@ -615,7 +624,7 @@ vfs_parse_ls_lga (char *p, struct stat *st, char **filename, char **linkname)
#ifdef HACK
st->st_gid = findgid (columns [2]);
#else
- gnameToGid (columns [1], &st->st_gid);
+ (void) gnameToGid (columns [1], &st->st_gid);
#endif
idx2 = 3;
}
@@ -731,7 +740,9 @@ error:
}
#endif
+ /*@-usereleased@*/
if (p_copy != p) /* Carefull! */
+ /*@=usereleased@*/
g_free (p_copy);
return 0;
}
@@ -749,7 +760,7 @@ static /*@only@*/ char * ftpBuf = NULL;
#define alloca_strdup(_s) strcpy(alloca(strlen(_s)+1), (_s))
static int ftpNLST(const char * url, ftpSysCall_t ftpSysCall,
- struct stat * st, char * rlbuf, size_t rlbufsiz)
+ /*@out@*/ struct stat * st, char * rlbuf, size_t rlbufsiz)
{
FD_t fd;
const char * path;
@@ -916,16 +927,16 @@ static int ftpNLST(const char * url, ftpSysCall_t ftpSysCall,
}
exit:
- ufdClose(fd);
+ (void) ufdClose(fd);
return rc;
}
-static int ftpStat(const char * path, struct stat *st)
+static int ftpStat(const char * path, /*@out@*/ struct stat *st)
{
return ftpNLST(path, DO_FTP_STAT, st, NULL, 0);
}
-static int ftpLstat(const char * path, struct stat *st) {
+static int ftpLstat(const char * path, /*@out@*/ struct stat *st) {
int rc;
rc = ftpNLST(path, DO_FTP_LSTAT, st, NULL, 0);
if (_rpmio_debug)
@@ -938,15 +949,18 @@ static int ftpReadlink(const char * path, char * buf, size_t bufsiz) {
}
static int ftpGlob(const char * path, int flags,
- int errfunc(const char * epath, int eerno), glob_t * pglob)
+ int errfunc(const char * epath, int eerno),
+ /*@out@*/ glob_t * pglob)
{
int rc;
if (pglob == NULL)
return -2;
rc = ftpNLST(path, DO_FTP_GLOB, NULL, NULL, 0);
+/*@-castfcnptr@*/
if (_rpmio_debug)
-fprintf(stderr, "*** ftpGlob(%s,0x%x,%p,%p) ftpNLST rc %d\n", path, (unsigned)flags, errfunc, pglob, rc);
+fprintf(stderr, "*** ftpGlob(%s,0x%x,%p,%p) ftpNLST rc %d\n", path, (unsigned)flags, (void *)errfunc, pglob, rc);
+/*@=castfcnptr@*/
if (rc)
return rc;
rc = poptParseArgvString(ftpBuf, &pglob->gl_pathc, (const char ***)&pglob->gl_pathv);
@@ -957,8 +971,10 @@ fprintf(stderr, "*** ftpGlob(%s,0x%x,%p,%p) ftpNLST rc %d\n", path, (unsigned)fl
static void ftpGlobfree(glob_t * pglob) {
if (_rpmio_debug)
fprintf(stderr, "*** ftpGlobfree(%p)\n", pglob);
- if (pglob->gl_offs == -1) /* XXX HACK HACK HACK */
+ if (pglob->gl_offs == -1) { /* XXX HACK HACK HACK */
free((void *)pglob->gl_pathv);
+ pglob->gl_pathv = NULL;
+ }
}
int Stat(const char * path, struct stat * st) {
@@ -1059,8 +1075,10 @@ int Glob(const char *path, int flags,
const char * lpath;
int ut = urlPath(path, &lpath);
+/*@-castfcnptr@*/
if (_rpmio_debug)
-fprintf(stderr, "*** Glob(%s,0x%x,%p,%p)\n", path, (unsigned)flags, errfunc, pglob);
+fprintf(stderr, "*** Glob(%s,0x%x,%p,%p)\n", path, (unsigned)flags, (void *)errfunc, pglob);
+/*@=castfcnptr@*/
switch (ut) {
case URL_IS_FTP: /* XXX WRONG WRONG WRONG */
return ftpGlob(path, flags, errfunc, pglob);
@@ -1112,16 +1130,18 @@ fprintf(stderr, "*** Opendir(%s)\n", path);
return opendir(path);
}
+/*@+voidabstract@*/
struct dirent * Readdir(DIR * dir)
{
if (_rpmio_debug)
-fprintf(stderr, "*** Readdir(%p)\n", dir);
+fprintf(stderr, "*** Readdir(%p)\n", (void *)dir);
return readdir(dir);
}
int Closedir(DIR * dir)
{
if (_rpmio_debug)
-fprintf(stderr, "*** Closedir(%p)\n", dir);
+fprintf(stderr, "*** Closedir(%p)\n", (void *)dir);
return closedir(dir);
}
+/*@=voidabstract@*/
diff --git a/rpmio/url.c b/rpmio/url.c
index 1d4d46905..a6b4e30da 100644
--- a/rpmio/url.c
+++ b/rpmio/url.c
@@ -78,11 +78,11 @@ URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file,
void * fp = fdGetFp(u->ctrl);
if (fp) {
fdPush(u->ctrl, fpio, fp, -1); /* Push fpio onto stack */
- Fclose(u->ctrl);
+ (void) Fclose(u->ctrl);
} else if (fdio->_fileno(u->ctrl) >= 0)
fdio->close(u->ctrl);
#else
- Fclose(u->ctrl);
+ (void) Fclose(u->ctrl);
#endif
u->ctrl = fdio->_fdderef(u->ctrl, "persist ctrl (urlFree)", file, line);
@@ -97,11 +97,11 @@ URLDBGREFS(0, (stderr, "--> url %p -- %d %s at %s:%u\n", u, u->nrefs, msg, file,
void * fp = fdGetFp(u->data);
if (fp) {
fdPush(u->data, fpio, fp, -1); /* Push fpio onto stack */
- Fclose(u->data);
+ (void) Fclose(u->data);
} else if (fdio->_fileno(u->data) >= 0)
fdio->close(u->data);
#else
- Fclose(u->ctrl);
+ (void) Fclose(u->ctrl);
#endif
u->data = fdio->_fdderef(u->data, "persist data (urlFree)", file, line);
@@ -209,11 +209,16 @@ static void urlFind(urlinfo *uret, int mustAsk)
u = urlLink(uCache[ucx], "uCache");
*uret = u;
+ /*@-usereleased@*/
u = urlFree(u, "uCache (urlFind)");
+ /*@=usereleased@*/
/* Zap proxy host and port in case they have been reset */
u->proxyp = -1;
- if (u->proxyh) free((void *)u->proxyh);
+ if (u->proxyh) {
+ free((void *)u->proxyh);
+ u->proxyh = NULL;
+ }
/* Perform one-time FTP initialization */
if (u->urltype == URL_IS_FTP) {
@@ -478,9 +483,9 @@ fprintf(stderr, "*** urlGetFile sfd %p %s tfd %p %s\n", sfd, url, tfd, dest);
case URL_IS_DASH:
case URL_IS_UNKNOWN:
if ((rc = ufdGetFile(sfd, tfd))) {
- Unlink(dest);
+ (void) Unlink(dest);
/* XXX FIXME: sfd possibly closed by copyData */
- /*@-usereleased@*/ Fclose(sfd) /*@=usereleased@*/ ;
+ /*@-usereleased@*/ (void) Fclose(sfd) /*@=usereleased@*/ ;
}
sfd = NULL; /* XXX Fclose(sfd) done by ufdGetFile */
break;
@@ -491,9 +496,9 @@ fprintf(stderr, "*** urlGetFile sfd %p %s tfd %p %s\n", sfd, url, tfd, dest);
exit:
if (tfd)
- Fclose(tfd);
+ (void) Fclose(tfd);
if (sfd)
- Fclose(sfd);
+ (void) Fclose(sfd);
return rc;
}