Commit 1bddcb7d authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

flexelint silencing



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@3977 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent dedd7a3e
......@@ -9,6 +9,8 @@
-emacro(736, isnan) // isnanf
-efile(766, ../../config.h)
-esym(850, av)
// -header(../../config.h)
......@@ -77,6 +79,10 @@
// -e641 // Converting enum 'cli_status_e' to int
//
// // Review all below this line ///////////////////////////////////////////////
-e457 // unprotected write access
-e459 // unprotected access
-e458 // unprotected access
//
-e732 // Loss of sign (arg. no. 2) (int to unsigned
-e737 // [45] Loss of sign in promotion from int to unsigned
......
......@@ -71,8 +71,10 @@ read_file(const char *fn)
buf = malloc(sz);
assert(buf != NULL);
s = read(fd, buf, sz - 1);
if (s <= 0)
if (s <= 0) {
free(buf);
return (NULL);
}
AZ(close (fd));
assert(s < sz); /* XXX: increase MAX_FILESIZE */
buf[s] = '\0';
......@@ -335,7 +337,7 @@ cmd_random(CMD_ARGS)
* Execute a file
*/
static struct cmds cmds[] = {
static const struct cmds cmds[] = {
{ "server", cmd_server },
{ "client", cmd_client },
{ "varnish", cmd_varnish },
......@@ -440,6 +442,6 @@ main(int argc, char * const *argv)
fok = fopen("_.ok", "w");
if (fok != NULL)
fclose(fok);
AZ(fclose(fok));
return (0);
}
......@@ -57,7 +57,7 @@ extern char *vtc_desc;
extern int vtc_verbosity;
extern int vtc_error; /* Error, bail out */
extern int vtc_stop; /* Abandon current test, no error */
extern pthread_t vtc_thread;;
extern pthread_t vtc_thread;
void init_sema(void);
......
......@@ -72,7 +72,7 @@ client_thread(void *priv)
{
struct client *c;
struct vtclog *vl;
int fd = -1;
int fd;
int i;
CAST_OBJ_NOTNULL(c, priv, CLIENT_MAGIC);
......@@ -84,7 +84,7 @@ client_thread(void *priv)
vtc_log(vl, 3, "Connect to %s", c->connect);
fd = VSS_open(c->connect);
for (i = 0; fd < 0 && i < 3; i++) {
sleep(1);
(void)sleep(1);
fd = VSS_open(c->connect);
}
assert(fd >= 0);
......
......@@ -70,7 +70,7 @@ struct http {
};
/* XXX: we may want to vary this */
static const char *nl = "\r\n";
static const char * const nl = "\r\n";
/**********************************************************************
* Generate a synthetic body
......@@ -359,7 +359,7 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
p = http_find_header(hh, "content-length");
if (p != NULL) {
l = strtoul(p, NULL, 0);
hp->body = q = hp->rxbuf + hp->prxbuf;
hp->body = hp->rxbuf + hp->prxbuf;
http_rxchar(hp, l);
vtc_dump(hp->vl, 4, "body", hp->body);
sprintf(hp->bodylen, "%d", l);
......@@ -397,7 +397,7 @@ http_swallow_body(struct http *hp, char * const *hh, int body)
return;
}
if (body) {
hp->body = q = hp->rxbuf + hp->prxbuf;
hp->body = hp->rxbuf + hp->prxbuf;
do {
i = http_rxchar_eof(hp, 1);
ll += i;
......@@ -423,7 +423,6 @@ http_rxhdr(struct http *hp)
while (1) {
http_rxchar(hp, 1);
p = hp->rxbuf + hp->prxbuf - 1;
i = 0;
for (i = 0; p > hp->rxbuf; p--) {
if (*p != '\n')
break;
......@@ -719,14 +718,14 @@ cmd_http_timeout(CMD_ARGS)
CAST_OBJ_NOTNULL(hp, priv, HTTP_MAGIC);
AN(av[1]);
AZ(av[2]);
hp->timeout = strtod(av[1], NULL) * 1000.0;
hp->timeout = (int)(strtod(av[1], NULL) * 1000.0);
}
/**********************************************************************
* Execute HTTP specifications
*/
static struct cmds http_cmds[] = {
static const struct cmds http_cmds[] = {
{ "timeout", cmd_http_timeout },
{ "txreq", cmd_http_txreq },
......
......@@ -75,7 +75,7 @@ vtc_logclose(struct vtclog *vl)
FREE_OBJ(vl);
}
static const char *lead[] = {
static const char * const lead[] = {
"----",
"# ",
"## ",
......
......@@ -234,7 +234,7 @@ cmd_server(CMD_ARGS)
VTAILQ_FOREACH_SAFE(s, &servers, list, s2) {
VTAILQ_REMOVE(&servers, s, list);
if (s->sock >= 0) {
pthread_cancel(s->tp);
(void)pthread_cancel(s->tp);
server_wait(s);
}
server_delete(s);
......
......@@ -152,12 +152,12 @@ varnish_new(const char *name)
REPLACE(v->name, name);
if (getuid() == 0)
asprintf(&v->workdir, "/tmp/__%s", name);
(void)asprintf(&v->workdir, "/tmp/__%s", name);
else
asprintf(&v->workdir, "/tmp/__%s.%d", name, getuid());
(void)asprintf(&v->workdir, "/tmp/__%s.%d", name, getuid());
AN(v->workdir);
asprintf(&c, "rm -rf %s ; mkdir -p %s", v->workdir, v->workdir);
(void)asprintf(&c, "rm -rf %s ; mkdir -p %s", v->workdir, v->workdir);
AZ(system(c));
v->vl = vtc_logopen(name);
......@@ -273,7 +273,7 @@ varnish_launch(struct varnish *v)
AZ(close(v->fds[2]));
AZ(close(v->fds[3]));
for (i = 3; i <getdtablesize(); i++)
close(i);
(void)close(i);
AZ(execl("/bin/sh", "/bin/sh", "-c", vsb_data(vsb), NULL));
exit(1);
}
......@@ -348,7 +348,8 @@ varnish_stop(struct varnish *v)
if (!strcmp(r, "Child in state stopped"))
break;
free(r);
sleep (1);
(void)sleep (1);
/* XXX: should fail eventually */
}
}
......@@ -365,7 +366,7 @@ varnish_wait(struct varnish *v)
if (v->cli_fd < 0)
return;
if (vtc_error)
sleep(1); /* give panic messages a chance */
(void)sleep(1); /* give panic messages a chance */
varnish_stop(v);
vtc_log(v->vl, 2, "Wait");
AZ(close(v->cli_fd));
......@@ -507,7 +508,7 @@ varnish_expect(const struct varnish *v, char * const *av) {
good = 0;
for (i = 0; i < 10; i++, usleep(100000)) {
for (i = 0; i < 10; i++, (void)usleep(100000)) {
#define MAC_STAT(n, t, l, f, d) \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment