mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Store the file size as zero when the magic header will be written before the size is known.
This commit is contained in:
parent
a10d423596
commit
d87df4f44e
5
lrzip.c
5
lrzip.c
|
|
@ -57,7 +57,10 @@ void write_magic(rzip_control *control, int fd_in, int fd_out)
|
|||
if (unlikely(fstat(fd_in, &st)))
|
||||
fatal("bad magic file descriptor!?\n");
|
||||
|
||||
memcpy(&magic[6], &control->st_size, 8);
|
||||
/* File size is stored as zero for streaming STDOUT blocks when the
|
||||
* file size is unknown. */
|
||||
if (!STDIN || !STDOUT || control->eof)
|
||||
memcpy(&magic[6], &control->st_size, 8);
|
||||
|
||||
/* save LZMA compression flags */
|
||||
if (LZMA_COMPRESS) {
|
||||
|
|
|
|||
|
|
@ -180,6 +180,7 @@ struct rzip_control {
|
|||
int encrypt;
|
||||
i64 secs;
|
||||
i64 usecs;
|
||||
int eof;
|
||||
md5_ctx ctx;
|
||||
i64 md5_read; // How far into the file the md5 has done so far
|
||||
};
|
||||
|
|
|
|||
2
rzip.c
2
rzip.c
|
|
@ -694,7 +694,7 @@ static void mmap_stdin(rzip_control *control, uchar *buf, struct rzip_state *st)
|
|||
if (unlikely(buf == MAP_FAILED))
|
||||
fatal("Failed to remap to smaller buf in mmap_stdin\n");
|
||||
st->mmap_size = st->chunk_size = total;
|
||||
st->stdin_eof = 1;
|
||||
control->eof = st->stdin_eof = 1;
|
||||
break;
|
||||
}
|
||||
offset_buf += ret;
|
||||
|
|
|
|||
Loading…
Reference in a new issue