aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/xz/coder.c9
-rw-r--r--src/xz/file_io.c4
2 files changed, 13 insertions, 0 deletions
diff --git a/src/xz/coder.c b/src/xz/coder.c
index f952e80d..4f51e8d5 100644
--- a/src/xz/coder.c
+++ b/src/xz/coder.c
@@ -931,6 +931,15 @@ coder_run(const char *filename)
mytime_set_start_time();
// Initialize the progress indicator.
+ //
+ // NOTE: When reading from stdin, fstat()
+ // isn't called on it and thus src_st.st_size
+ // is zero. If stdin pointed to a regular
+ // file, it would still be possible to know
+ // the file size but then we would also need
+ // to take into account the current reading
+ // position since with stdin it isn't
+ // necessarily at the beginning of the file.
const bool is_passthru = init_ret
== CODER_INIT_PASSTHRU;
const uint64_t in_size
diff --git a/src/xz/file_io.c b/src/xz/file_io.c
index 76b1967e..41e4c2d8 100644
--- a/src/xz/file_io.c
+++ b/src/xz/file_io.c
@@ -755,6 +755,10 @@ io_open_src(const char *src_name)
// a statically allocated structure.
static file_pair pair;
+ // This implicitly also initializes src_st.st_size to zero
+ // which is expected to be <= 0 by default. fstat() isn't
+ // called when reading from standard input but src_st.st_size
+ // is still read.
pair = (file_pair){
.src_name = src_name,
.dest_name = NULL,