From 7db86c706e53dcde0afcbbe61cbb185fec10caa6 Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 24 Jun 2008 21:37:22 +0000 Subject: [PATCH] Fix an interesting shortcoming in GCC's error checks which Flexelint correctly spotted: deconsting through strchr(). A couple of other flexelint nits while here git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2796 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishd/mgt_cli.c | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/varnish-cache/bin/varnishd/mgt_cli.c b/varnish-cache/bin/varnishd/mgt_cli.c index ae6ac742..f369ce1d 100644 --- a/varnish-cache/bin/varnishd/mgt_cli.c +++ b/varnish-cache/bin/varnishd/mgt_cli.c @@ -132,7 +132,7 @@ static struct cli_proto cli_proto[] = { { 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 @@ mgt_cli_vlu(void *priv, const char *p) 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 @@ telnet_accept(const struct ev *ev, int what) 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); -- 2.39.5