[PATCH 3/9] read_istream_filtered: propagate read error from upstream
- From
Jeff King <peff@peff.net>
- Date
- Mar 25, 2013, 20:18 UTC
- Message-ID
- <20130325201816.GC16019@sigill.intra.peff.net>
- In-Reply-To
- <20130325201427.GA15798@sigill.intra.peff.net>
The filter istream pulls data from an "upstream" stream, running it through a filter function. However, we did not properly notice when the upstream filter yielded an error, and just returned what we had read. Instead, we should propagate the error.
Signed-off-by: Jeff King <peff@peff.net> --- I don't know if we should be preserving fs->i_end from getting a negative value. I would think the internal state of the istream after an error is undefined.
streaming.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/streaming.c b/streaming.c index f4126a7..f4ab12b 100644 --- a/streaming.c +++ b/streaming.c @@ -237,7 +237,7 @@ static read_method_decl(filtered) if (!fs->input_finished) { fs->i_end = read_istream(fs->upstream, fs->ibuf, FILTER_BUFFER); if (fs->i_end < 0) - break; + return -1; if (fs->i_end) continue; }
-- 1.8.2.13.g0f18d3c