Commit a6adc54e authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Handle CLI trouble with the childproc


git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@730 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ea5cda30
...@@ -86,7 +86,6 @@ mcf_passthru(struct cli *cli, char **av, void *priv) ...@@ -86,7 +86,6 @@ mcf_passthru(struct cli *cli, char **av, void *priv)
free(p); free(p);
i = cli_readres(cli_i, &u, &p, 3.0); i = cli_readres(cli_i, &u, &p, 3.0);
assert(i == 0);
cli_result(cli, u); cli_result(cli, u);
cli_out(cli, "%s", p); cli_out(cli, "%s", p);
free(p); free(p);
...@@ -174,7 +173,7 @@ int ...@@ -174,7 +173,7 @@ int
mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...)
{ {
char *p; char *p;
int i; int i, j;
va_list ap; va_list ap;
unsigned u; unsigned u;
...@@ -186,9 +185,16 @@ mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) ...@@ -186,9 +185,16 @@ mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...)
if (i < 0) if (i < 0)
return (i); return (i);
assert(p[i - 1] == '\n'); assert(p[i - 1] == '\n');
i = write(cli_o, p, strlen(p)); j = write(cli_o, p, i);
assert(i == strlen(p));
free(p); free(p);
if (j != i) {
free(p);
if (status != NULL)
*status = CLIS_COMMS;
if (resp != NULL)
*resp = strdup("CLI communication error");
return (CLIS_COMMS);
}
i = cli_readres(cli_i, &u, resp, 3.0); i = cli_readres(cli_i, &u, resp, 3.0);
assert(i == 0); assert(i == 0);
......
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