From e7d33e82d0db30b6c12ce9ff91f33b27ed0f47c4 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Sat, 19 Mar 2011 14:46:06 +1100 Subject: [PATCH] Make read_1g able to read from the tmp outbuf if we decide to read from fd_out. --- stream.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/stream.c b/stream.c index c7b34d9..26827e0 100644 --- a/stream.c +++ b/stream.c @@ -736,6 +736,14 @@ ssize_t read_1g(rzip_control *control, int fd, void *buf, i64 len) return len; } + if (TMP_OUTBUF && fd == control->fd_out) { + if (unlikely(control->out_ofs + len > control->out_maxlen)) + failure("Trying to read beyond out_ofs in tmpoutbuf\n"); + memcpy(buf, control->tmp_outbuf + control->out_ofs, len); + control->out_ofs += len; + return len; + } + read_fd: total = 0; while (len > 0) {