diff options
author | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 10:16:06 +0000 |
---|---|---|
committer | Daniel Baumann <mail@daniel-baumann.ch> | 2015-11-07 10:16:06 +0000 |
commit | 0d53d0bcfd869d5b4eb69238c0c0022debc3aa60 (patch) | |
tree | 9e0fbce89572e5400e31491fa3130b220afcf189 /decoder.cc | |
parent | Adding upstream version 1.13~rc1. (diff) | |
download | lziprecover-0d53d0bcfd869d5b4eb69238c0c0022debc3aa60.tar.xz lziprecover-0d53d0bcfd869d5b4eb69238c0c0022debc3aa60.zip |
Adding upstream version 1.13~rc2.upstream/1.13_rc2
Signed-off-by: Daniel Baumann <mail@daniel-baumann.ch>
Diffstat (limited to 'decoder.cc')
-rw-r--r-- | decoder.cc | 11 |
1 files changed, 8 insertions, 3 deletions
@@ -108,9 +108,14 @@ void LZ_decoder::flush_data() if( size > 0 ) { crc32.update( crc_, buffer + stream_pos, size ); - if( outfd >= 0 && - writeblock( outfd, buffer + stream_pos, size ) != size ) - throw Error( "Write error" ); + if( outfd >= 0 ) + { + const long long i = std::max( 0LL, outskip - stream_position() ); + const long long s = + std::min( outend - stream_position(), (long long)size ) - i; + if( s > 0 && writeblock( outfd, buffer + stream_pos + i, s ) != s ) + throw Error( "Write error" ); + } if( pos >= buffer_size ) { partial_data_pos += pos; pos = 0; } stream_pos = pos; } |