r2796 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Tue Jun 24 23:37:32 CEST 2008


Author: phk
Date: 2008-06-24 23:37:22 +0200 (Tue, 24 Jun 2008)
New Revision: 2796

Modified:
   trunk/varnish-cache/bin/varnishd/mgt_cli.c
Log:
Fix an interesting shortcoming in GCC's error checks which Flexelint 
correctly spotted: deconsting through strchr().

A couple of other flexelint nits while here




Modified: trunk/varnish-cache/bin/varnishd/mgt_cli.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/mgt_cli.c	2008-06-24 21:30:24 UTC (rev 2795)
+++ trunk/varnish-cache/bin/varnishd/mgt_cli.c	2008-06-24 21:37:22 UTC (rev 2796)
@@ -132,7 +132,7 @@
 	{ CLI_PING,		cli_func_ping },
 	{ CLI_SERVER_STATUS,	mcf_server_status, NULL },
 	{ CLI_SERVER_START,	mcf_server_startstop, NULL },
-	{ CLI_SERVER_STOP,	mcf_server_startstop, &cli_proto },
+	{ CLI_SERVER_STOP,	mcf_server_startstop, cli_proto },
 	{ CLI_STATS,		mcf_stats, NULL },
 	{ CLI_VCL_LOAD,		mcf_config_load, NULL },
 	{ CLI_VCL_INLINE,	mcf_config_inline, NULL },
@@ -241,14 +241,12 @@
 	CAST_OBJ_NOTNULL(cp, priv, CLI_PORT_MAGIC);
 	vsb_clear(cp->cli->sb);
 
-	/* Remove trailing whitespace */
-	q = strchr(p, '\0');
-	while (q > p && isspace(q[-1]))
-		q--;
-	*q = '\0';
+	/* Skip whitespace */
+	for (; isspace(*p); p++)
+		continue;
 
 	/* Ignore empty lines */
-	if (*p == 0)
+	if (*p == '\0')
 		return (0);
 
 	cli_dispatch(cp->cli, cli_proto, p);
@@ -449,7 +447,7 @@
 	asprintf(&p, "telnet %s:%s %s:%s", abuf2, pbuf2, abuf1, pbuf1);
 	XXXAN(p);
 
-	telnet_new(i);
+	(void)telnet_new(i);
 
 	mgt_cli_setup(i, i, 0, p);
 	free(p);




More information about the varnish-commit mailing list