mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Refuse to compress a file smaller than a minimum size.
This commit is contained in:
parent
fca5d4232c
commit
091909b552
4
rzip.c
4
rzip.c
|
|
@ -689,6 +689,8 @@ static void mmap_stdin(rzip_control *control, uchar *buf, struct rzip_state *st)
|
||||||
total += ret;
|
total += ret;
|
||||||
if (ret == 0) {
|
if (ret == 0) {
|
||||||
/* Should be EOF */
|
/* Should be EOF */
|
||||||
|
if (total < 128)
|
||||||
|
failure("Will not compress a tiny file\n");
|
||||||
print_maxverbose("Shrinking chunk to %lld\n", total);
|
print_maxverbose("Shrinking chunk to %lld\n", total);
|
||||||
buf = (uchar *)mremap(buf, st->chunk_size, total, 0);
|
buf = (uchar *)mremap(buf, st->chunk_size, total, 0);
|
||||||
if (unlikely(buf == MAP_FAILED))
|
if (unlikely(buf == MAP_FAILED))
|
||||||
|
|
@ -785,6 +787,8 @@ void rzip_fd(rzip_control *control, int fd_in, int fd_out)
|
||||||
|
|
||||||
if (!STDIN) {
|
if (!STDIN) {
|
||||||
len = control->st_size = s.st_size;
|
len = control->st_size = s.st_size;
|
||||||
|
if (len < 128)
|
||||||
|
failure("Will not compress a tiny file\n");
|
||||||
print_verbose("File size: %lld\n", len);
|
print_verbose("File size: %lld\n", len);
|
||||||
} else
|
} else
|
||||||
control->st_size = 0;
|
control->st_size = 0;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue