aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/xz/coder.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index 98e9783a..fdd2e304 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -626,6 +626,15 @@ coder_init(file_pair *pair)
== LZMA_UNSUPPORTED_CHECK)
message_warning("%s: %s", pair->src_name,
message_strm(ret));
+
+ // With --single-stream lzma_code won't wait for
+ // LZMA_FINISH and thus it can return LZMA_STREAM_END
+ // if the file has no uncompressed data inside.
+ // So treat LZMA_STREAM_END as LZMA_OK here.
+ // When lzma_code() is called again in coder_normal()
+ // it will return LZMA_STREAM_END again.
+ if (ret == LZMA_STREAM_END)
+ ret = LZMA_OK;
}
#endif
}