Commit 665794fa authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Give vtc_record() the ability to collect the bits in a VSB

parent 6643c5f4
......@@ -134,7 +134,7 @@ struct vsb *vtc_hex_to_bin(struct vtclog *vl, const char *arg);
void vtc_expect(struct vtclog *, const char *, const char *, const char *,
const char *, const char *);
void vtc_wait4(struct vtclog *, long, int, int, int);
void *vtc_record(struct vtclog *, int);
void *vtc_record(struct vtclog *, int, struct vsb *);
/* vtc_term.c */
struct term *Term_New(struct vtclog *, int, int);
......
......@@ -243,7 +243,7 @@ haproxy_thread(void *priv)
struct haproxy *h;
CAST_OBJ_NOTNULL(h, priv, HAPROXY_MAGIC);
return (vtc_record(h->vl, h->fds[0]));
return (vtc_record(h->vl, h->fds[0], NULL));
}
/**********************************************************************
......
......@@ -187,7 +187,7 @@ vtc_wait4(struct vtclog *vl, long pid,
}
void *
vtc_record(struct vtclog *vl, int fd)
vtc_record(struct vtclog *vl, int fd, struct vsb *vsb)
{
char buf[65536];
struct pollfd fds[1];
......@@ -204,6 +204,8 @@ vtc_record(struct vtclog *vl, int fd)
if (fds->revents & POLLIN) {
i = read(fd, buf, sizeof buf - 1);
if (i > 0) {
if (vsb != NULL)
VSB_bcat(vsb, buf, i);
buf[i] = '\0';
vtc_dump(vl, 3, "debug", buf, -2);
}
......
......@@ -376,7 +376,7 @@ varnish_thread(void *priv)
struct varnish *v;
CAST_OBJ_NOTNULL(v, priv, VARNISH_MAGIC);
return (vtc_record(v->vl, v->fds[0]));
return (vtc_record(v->vl, v->fds[0], NULL));
}
/**********************************************************************
......
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