Prepare to write compressed output by flushing stdout after each chunk is compressed.

This commit is contained in:
Con Kolivas 2011-03-12 19:56:08 +11:00
parent c75a50f723
commit 7fbec0a783
5 changed files with 34 additions and 8 deletions

View file

@ -637,10 +637,12 @@ const i64 one_g = 1000 * 1024 * 1024;
ssize_t put_fdout(rzip_control *control, int fd, void *offset_buf, ssize_t ret)
{
if (!STDOUT)
if (!STDOUT || DECOMPRESS)
return write(fd, offset_buf, (size_t)ret);
memcpy(control->tmp_outbuf, offset_buf, ret);
control->out_ofs += ret;
if (likely(control->out_ofs > control->out_len))
control->out_len = control->out_ofs;
return ret;
}