From 616181f3c757160af8539869a6d929faca4962c4 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Fri, 14 Aug 2015 13:19:22 +0200 Subject: common/iobuf.c: Flush the pipeline in iobuf_temp_to_buffer. * common/iobuf.c (iobuf_temp_to_buffer): Flush each filter in the pipeline and copy the data from the last (not the first) filter's internal buffer. -- Signed-off-by: Neal H. Walfield . --- common/iobuf.c | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/common/iobuf.c b/common/iobuf.c index c5e43cc8e..e6b70a114 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -2123,8 +2123,20 @@ iobuf_write_temp (iobuf_t a, iobuf_t temp) size_t iobuf_temp_to_buffer (iobuf_t a, byte * buffer, size_t buflen) { - size_t n = a->d.len; + size_t n; + while (1) + { + int rc = filter_flush (a); + if (rc) + log_bug ("Flushing iobuf %d.%d (%s) from iobuf_temp_to_buffer failed. Ignoring.\n", + a->no, a->subno, iobuf_desc (a)); + if (! a->chain) + break; + a = a->chain; + } + + n = a->d.len; if (n > buflen) n = buflen; memcpy (buffer, a->d.buf, n); -- cgit v1.2.3