From e138fa77ff1f961f7664f1292c18de5ce8d4c370 Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 14 Mar 2011 10:19:53 +1100 Subject: [PATCH] Use temporary files for now with TEST_ONLY mode. --- lrzip.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lrzip.c b/lrzip.c index 63049d4..1b10e80 100644 --- a/lrzip.c +++ b/lrzip.c @@ -438,13 +438,17 @@ void decompress_file(rzip_control *control) control->flags |= FLAG_KEEP_BROKEN; fatal("Failed to create %s\n", control->outfile); } + fd_hist = open(control->outfile, O_RDONLY); + if (unlikely(fd_hist == -1)) + fatal("Failed to open history file %s\n", control->outfile); preserve_perms(control, fd_in, fd_out); } else { /* When using a temporary output buffer we still generate * temporary output files in case we use them should we run * out of space. */ - open_tmpoutbuf(control); + if (!TEST_ONLY) + open_tmpoutbuf(control); fd_out = open_tmpoutfile(control); if (unlikely(fd_out == -1)) fatal("Failed to create %s\n", control->outfile); @@ -470,9 +474,6 @@ void decompress_file(rzip_control *control) else failure("Inadequate free space to decompress file, use -f to override.\n"); } - fd_hist = open(control->outfile, O_RDONLY); - if (unlikely(fd_hist == -1)) - fatal("Failed to open history file %s\n", control->outfile); } control->fd_out = fd_out; control->fd_hist = fd_hist;