OSDN Git Service

read_istream_filtered: propagate read error from upstream
authorJeff King <peff@peff.net>
Mon, 25 Mar 2013 20:18:16 +0000 (16:18 -0400)
committerJunio C Hamano <gitster@pobox.com>
Wed, 27 Mar 2013 20:46:58 +0000 (13:46 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
streaming.c

index f4126a7..f4ab12b 100644 (file)
@@ -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;
                }