mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Clear the temporary infile where possible as well when we have falen back to it.
This commit is contained in:
parent
65a681a254
commit
e26d0d1381
8
lrzip.c
8
lrzip.c
|
|
@ -452,6 +452,14 @@ void clear_tmpinbuf(rzip_control *control)
|
||||||
control->in_len = control->in_ofs = 0;
|
control->in_len = control->in_ofs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void clear_tmpinfile(rzip_control *control)
|
||||||
|
{
|
||||||
|
if (unlikely(lseek(control->fd_in, 0, SEEK_SET)))
|
||||||
|
fatal("Failed to lseek on fd_in in clear_tmpinfile\n");
|
||||||
|
if (unlikely(ftruncate(control->fd_in, 0)))
|
||||||
|
fatal("Failed to truncate fd_in in clear_tmpinfile\n");
|
||||||
|
}
|
||||||
|
|
||||||
void close_tmpinbuf(rzip_control *control)
|
void close_tmpinbuf(rzip_control *control)
|
||||||
{
|
{
|
||||||
control->flags &= ~FLAG_TMP_INBUF;
|
control->flags &= ~FLAG_TMP_INBUF;
|
||||||
|
|
|
||||||
1
lrzip.h
1
lrzip.h
|
|
@ -37,5 +37,6 @@ void write_fdout(rzip_control *control, void *buf, i64 len);
|
||||||
void flush_tmpoutbuf(rzip_control *control);
|
void flush_tmpoutbuf(rzip_control *control);
|
||||||
void close_tmpoutbuf(rzip_control *control);
|
void close_tmpoutbuf(rzip_control *control);
|
||||||
void clear_tmpinbuf(rzip_control *control);
|
void clear_tmpinbuf(rzip_control *control);
|
||||||
|
void clear_tmpinfile(rzip_control *control);
|
||||||
void close_tmpinbuf(rzip_control *control);
|
void close_tmpinbuf(rzip_control *control);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
2
runzip.c
2
runzip.c
|
|
@ -327,6 +327,8 @@ i64 runzip_fd(rzip_control *control, int fd_in, int fd_out, int fd_hist, i64 exp
|
||||||
dump_tmpoutfile(control, fd_out);
|
dump_tmpoutfile(control, fd_out);
|
||||||
if (TMP_INBUF)
|
if (TMP_INBUF)
|
||||||
clear_tmpinbuf(control);
|
clear_tmpinbuf(control);
|
||||||
|
else if (STDIN)
|
||||||
|
clear_tmpinfile(control);
|
||||||
} while (total < expected_size || (!expected_size && !control->eof));
|
} while (total < expected_size || (!expected_size && !control->eof));
|
||||||
|
|
||||||
gettimeofday(&end,NULL);
|
gettimeofday(&end,NULL);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue