summaryrefslogtreecommitdiffstats
path: root/common/iobuf.c
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@g10code.com>2015-08-17 12:29:15 +0200
committerNeal H. Walfield <neal@g10code.com>2015-08-20 14:16:25 +0200
commit0d40c4e83f6fbfea2f494f1f88412d3132ff98bd (patch)
tree5f11ae6379611f7755b5b5609b478c53238b9ff3 /common/iobuf.c
parentcommon/iobuf.c: Buffered data should not be processed by new filters. (diff)
downloadgnupg2-0d40c4e83f6fbfea2f494f1f88412d3132ff98bd.tar.xz
gnupg2-0d40c4e83f6fbfea2f494f1f88412d3132ff98bd.zip
common/iobuf.c: Adjust buffer size of filters in front of temp filters.
* common/iobuf.c (iobuf_push_filter2): If the head filter is a temp filter, use IOBUF_BUFFER_SIZE for the new filter. -- Signed-off-by: Neal H. Walfield <neal@g10code.com>.
Diffstat (limited to 'common/iobuf.c')
-rw-r--r--common/iobuf.c17
1 files changed, 15 insertions, 2 deletions
diff --git a/common/iobuf.c b/common/iobuf.c
index 6d85124eb..7d75e33f7 100644
--- a/common/iobuf.c
+++ b/common/iobuf.c
@@ -1604,8 +1604,21 @@ iobuf_push_filter2 (iobuf_t a,
a->filter_ov_owner = 0;
a->filter_eof = 0;
if (a->use == IOBUF_TEMP)
- /* make a write stream from a temp stream */
- a->use = IOBUF_OUTPUT;
+ /* A TEMP filter buffers any data sent to it; it does not forward
+ any data down the pipeline. If we add a new filter to the
+ pipeline, it shouldn't also buffer data. It should send it
+ downstream to be buffered. Thus, the correct type for a filter
+ added in front of an IOBUF_TEMP filter is IOBUF_OUPUT, not
+ IOBUF_TEMP. */
+ {
+ a->use = IOBUF_OUTPUT;
+
+ /* When pipeline is written to, the temp buffer's size is
+ increased accordingly. We don't need to allocate a 10 MB
+ buffer for a non-terminal filter. Just use the default
+ size. */
+ a->d.size = IOBUF_BUFFER_SIZE;
+ }
/* The new filter (A) gets a new buffer.