Forgot two instances of temporary outfiles that need to be unlinked.

This commit is contained in:
Con Kolivas 2011-03-07 13:44:29 +11:00
parent 68469c2b6f
commit 8a4df9774f

5
main.c
View file

@ -363,7 +363,7 @@ static void decompress_file(void)
fatal("Failed to open history file %s\n", control.outfile);
/* Unlink temporary file as soon as possible */
if (unlikely(STDOUT && unlink(control.outfile)))
if (unlikely((STDOUT || TEST_ONLY) && unlink(control.outfile)))
fatal("Failed to unlink tmpfile: %s\n", control.outfile);
if (NO_MD5)
@ -681,6 +681,9 @@ static void compress_file(void)
fd_out = open_tmpoutfile();
control.fd_out = fd_out;
if (unlikely(STDOUT && unlink(control.outfile)))
fatal("Failed to unlink tmpfile: %s\n", control.outfile);
preserve_perms(fd_in, fd_out);
/* write zeroes to 24 bytes at beginning of file */