aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2008-01-23 21:05:33 +0200
committerLasse Collin <lasse.collin@tukaani.org>2008-01-23 21:05:33 +0200
commitae0cd09a666a1682da8fc09487322227679e218d (patch)
tree07c5a69334461dc8966c3e3ffe54d26b2609fd25
parentAdded bad-single-none-footer_filter_flags.lzma and (diff)
downloadxz-ae0cd09a666a1682da8fc09487322227679e218d.tar.xz
Return LZMA_STREAM_END instead of LZMA_OK if
LZMA_SYNC_FLUSH or LZMA_FULL_FLUSH is used when there's no unfinished Block open.
-rw-r--r--src/liblzma/common/stream_encoder_multi.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/liblzma/common/stream_encoder_multi.c b/src/liblzma/common/stream_encoder_multi.c
index 33b4efd9..403980cf 100644
--- a/src/liblzma/common/stream_encoder_multi.c
+++ b/src/liblzma/common/stream_encoder_multi.c
@@ -276,8 +276,12 @@ stream_encode(lzma_coder *coder, lzma_allocator *allocator,
// Don't create an empty Block unless it would be
// the only Data Block.
if (*in_pos == in_size) {
+ // If we are LZMA_SYNC_FLUSHing or LZMA_FULL_FLUSHing,
+ // return LZMA_STREAM_END since there's nothing to
+ // flush.
if (action != LZMA_FINISH)
- return LZMA_OK;
+ return action == LZMA_RUN
+ ? LZMA_OK : LZMA_STREAM_END;
if (lzma_info_index_count_get(coder->info) != 0) {
if (lzma_info_index_finish(coder->info))