r3977 - trunk/varnish-cache/bin/varnishtest

phk at projects.linpro.no phk at projects.linpro.no
Sun Mar 22 15:09:33 CET 2009


Author: phk
Date: 2009-03-22 15:09:33 +0100 (Sun, 22 Mar 2009)
New Revision: 3977

Modified:
   trunk/varnish-cache/bin/varnishtest/flint.lnt
   trunk/varnish-cache/bin/varnishtest/vtc.c
   trunk/varnish-cache/bin/varnishtest/vtc.h
   trunk/varnish-cache/bin/varnishtest/vtc_client.c
   trunk/varnish-cache/bin/varnishtest/vtc_http.c
   trunk/varnish-cache/bin/varnishtest/vtc_log.c
   trunk/varnish-cache/bin/varnishtest/vtc_server.c
   trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
Log:
flexelint silencing



Modified: trunk/varnish-cache/bin/varnishtest/flint.lnt
===================================================================
--- trunk/varnish-cache/bin/varnishtest/flint.lnt	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/flint.lnt	2009-03-22 14:09:33 UTC (rev 3977)
@@ -9,7 +9,9 @@
 -emacro(736, isnan)  // isnanf
 -efile(766, ../../config.h)
 
+-esym(850, av)
 
+
 // -header(../../config.h)
 
 // Fix strchr() semtics, it can only return NULL if arg2 != 0
@@ -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

Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c	2009-03-22 14:09:33 UTC (rev 3977)
@@ -71,8 +71,10 @@
 	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 @@
  * 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 @@
 
 	fok = fopen("_.ok", "w");
 	if (fok != NULL)
-		fclose(fok);
+		AZ(fclose(fok));
 	return (0);
 }

Modified: trunk/varnish-cache/bin/varnishtest/vtc.h
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.h	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/vtc.h	2009-03-22 14:09:33 UTC (rev 3977)
@@ -57,7 +57,7 @@
 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);
 

Modified: trunk/varnish-cache/bin/varnishtest/vtc_client.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_client.c	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/vtc_client.c	2009-03-22 14:09:33 UTC (rev 3977)
@@ -72,7 +72,7 @@
 {
 	struct client *c;
 	struct vtclog *vl;
-	int fd = -1;
+	int fd;
 	int i;
 
 	CAST_OBJ_NOTNULL(c, priv, CLIENT_MAGIC);
@@ -84,7 +84,7 @@
 	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);

Modified: trunk/varnish-cache/bin/varnishtest/vtc_http.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_http.c	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/vtc_http.c	2009-03-22 14:09:33 UTC (rev 3977)
@@ -70,7 +70,7 @@
 };
 
 /* 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 @@
 	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 @@
 		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 @@
 	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 @@
 	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 },
 

Modified: trunk/varnish-cache/bin/varnishtest/vtc_log.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_log.c	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/vtc_log.c	2009-03-22 14:09:33 UTC (rev 3977)
@@ -75,7 +75,7 @@
 	FREE_OBJ(vl);
 }
 
-static const char *lead[] = {
+static const char * const lead[] = {
 	"----",
 	"#   ",
 	"##  ",

Modified: trunk/varnish-cache/bin/varnishtest/vtc_server.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_server.c	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/vtc_server.c	2009-03-22 14:09:33 UTC (rev 3977)
@@ -234,7 +234,7 @@
 		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);

Modified: trunk/varnish-cache/bin/varnishtest/vtc_varnish.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2009-03-22 13:35:38 UTC (rev 3976)
+++ trunk/varnish-cache/bin/varnishtest/vtc_varnish.c	2009-03-22 14:09:33 UTC (rev 3977)
@@ -152,12 +152,12 @@
 	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 @@
 		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 @@
 		if (!strcmp(r, "Child in state stopped"))
 			break;
 		free(r);
-		sleep (1);
+		(void)sleep (1);
+		/* XXX: should fail eventually */
 	}
 }
 
@@ -365,7 +366,7 @@
 	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 @@
 
 	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)					\



More information about the varnish-commit mailing list