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