aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNeal H. Walfield <[email protected]>2015-08-14 11:19:22 +0000
committerNeal H. Walfield <[email protected]>2015-08-20 12:16:23 +0000
commit616181f3c757160af8539869a6d929faca4962c4 (patch)
tree1a202cbbfe1052f0bdc4695823e9393ddb202d09
parentcommon/iobuf.c: Combine iobuf_open, iobuf_create and iobuf_openrw. (diff)
downloadgnupg-616181f3c757160af8539869a6d929faca4962c4.tar.gz
gnupg-616181f3c757160af8539869a6d929faca4962c4.zip
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 <[email protected]>.
Diffstat (limited to '')
-rw-r--r--common/iobuf.c14
1 files changed, 13 insertions, 1 deletions
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);