Make read_1g able to read from the tmp outbuf if we decide to read from fd_out.

This commit is contained in:
Con Kolivas 2011-03-19 14:46:06 +11:00
parent ff5a5ed054
commit e7d33e82d0

View file

@ -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) {