aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLasse Collin <lasse.collin@tukaani.org>2022-11-09 12:48:22 +0200
committerLasse Collin <lasse.collin@tukaani.org>2022-11-09 12:48:22 +0200
commitf723eec68b0e44234910f669a29119de33018967 (patch)
tree29110e418ac0896bb1134a01c26566fb6e2c5dc3 /src
parentxz: Add a comment why --to-stdout is not in --help. (diff)
downloadxz-f723eec68b0e44234910f669a29119de33018967.tar.xz
xz: Fix displaying of file sizes in progress indicator in passthru mode.
It worked for one input file since the counters are zero when xz starts but they weren't reset when starting a new file in passthru mode. For example, if files A, B, and C are one byte each, then "xz -dcvf A B C" would show file sizes as 1, 2, and 3 bytes instead of 1, 1, and 1 byte.
Diffstat (limited to 'src')
-rw-r--r--src/xz/coder.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index fdd2e304..d26ae6e9 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -560,8 +560,12 @@ coder_init(file_pair *pair)
// is needed, because we don't want to do use
// passthru mode with --test.
if (opt_mode == MODE_DECOMPRESS
- && opt_stdout && opt_force)
+ && opt_stdout && opt_force) {
+ // These are needed for progress info.
+ strm.total_in = 0;
+ strm.total_out = 0;
return CODER_INIT_PASSTHRU;
+ }
ret = LZMA_FORMAT_ERROR;
break;