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

Evict the last *asprintf usage.



git-svn-id: http://www.varnish-cache.org/svn/trunk@4580 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 6fb3a175
...@@ -208,10 +208,10 @@ static struct cli_proto cli_askchild[] = { ...@@ -208,10 +208,10 @@ static struct cli_proto cli_askchild[] = {
int int
mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) { mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) {
char *p;
int i, j; int i, j;
va_list ap; va_list ap;
unsigned u; unsigned u;
char buf[params->cli_buffer], *p;
if (resp != NULL) if (resp != NULL)
*resp = NULL; *resp = NULL;
...@@ -223,13 +223,12 @@ mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) { ...@@ -223,13 +223,12 @@ mgt_cli_askchild(unsigned *status, char **resp, const char *fmt, ...) {
return (CLIS_CANT); return (CLIS_CANT);
} }
va_start(ap, fmt); va_start(ap, fmt);
i = vasprintf(&p, fmt, ap); vbprintf(buf, fmt, ap);
va_end(ap); va_end(ap);
if (i < 0) p = strchr(buf, '\0');
return (i); assert(p != NULL && p > buf && p[-1] == '\n');
assert(p[i - 1] == '\n'); i = p - buf;
j = write(cli_o, p, i); j = write(cli_o, buf, i);
free(p);
if (j != i) { if (j != i) {
if (status != NULL) if (status != NULL)
*status = CLIS_COMMS; *status = CLIS_COMMS;
......
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