mirror of
https://github.com/ckolivas/lrzip.git
synced 2026-01-18 14:29:57 +01:00
Must read magic before testing free space.
Resolve conflict.
This commit is contained in:
parent
d1dc3dd6b1
commit
8a4814081b
34
main.c
34
main.c
|
|
@ -437,23 +437,31 @@ static void decompress_file(void)
|
|||
fd_out = open_tmpoutfile();
|
||||
control.fd_out = fd_out;
|
||||
|
||||
/* Check if there's enough free space on the device chosen to fit the
|
||||
* decompressed file. */
|
||||
if (unlikely(fstatvfs(fd_out, &fbuf)))
|
||||
fatal("Failed to fstatvfs in decompress_file\n");
|
||||
free_space = fbuf.f_bsize * fbuf.f_bavail;
|
||||
if (free_space < expected_size) {
|
||||
if (FORCE_REPLACE)
|
||||
print_err("Warning, inadequate free space detected, but attempting to decompress due to -f option being used.\n");
|
||||
else
|
||||
failure("Inadequate free space to decompress file, use -f to override.\n");
|
||||
}
|
||||
|
||||
fd_hist = open(control.outfile, O_RDONLY);
|
||||
if (control.tmp_outfile)
|
||||
fd_hist = shm_open(control.tmp_outfile, O_RDONLY, 0777);
|
||||
else
|
||||
fd_hist = open(control.outfile, O_RDONLY);
|
||||
if (unlikely(fd_hist == -1))
|
||||
fatal("Failed to open history file %s\n", control.outfile);
|
||||
control.fd_hist = fd_hist;
|
||||
|
||||
read_magic(fd_in, &expected_size);
|
||||
|
||||
/* Check if there's enough free space on the device chosen to fit the
|
||||
* decompressed file. */
|
||||
if (!STDOUT) {
|
||||
if (unlikely(fstatvfs(fd_out, &fbuf)))
|
||||
fatal("Failed to fstatvfs in decompress_file\n");
|
||||
free_space = fbuf.f_bsize * fbuf.f_bavail;
|
||||
if (free_space < expected_size) {
|
||||
if (FORCE_REPLACE)
|
||||
print_err("Warning, inadequate free space detected, but attempting to decompress due to -f option being used.\n");
|
||||
else
|
||||
failure("Inadequate free space to decompress file, use -f to override."
|
||||
" Free space %lld, expected size %lld\n", free_space, expected_size);
|
||||
}
|
||||
}
|
||||
|
||||
if (NO_MD5)
|
||||
print_verbose("Not performing MD5 hash check\n");
|
||||
if (HAS_MD5)
|
||||
|
|
|
|||
Loading…
Reference in a new issue