From 64afd02a7daa6876fdd5fa57ad99233677b28e7b Mon Sep 17 00:00:00 2001 From: Con Kolivas Date: Mon, 17 Oct 2016 21:25:36 +1100 Subject: [PATCH] Preserve times on compression --- lrzip.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lrzip.c b/lrzip.c index 0ebb4de..6be8144 100644 --- a/lrzip.c +++ b/lrzip.c @@ -1246,6 +1246,11 @@ bool compress_file(rzip_control *control) if (ENCRYPT) release_hashes(control); + if (unlikely(!STDIN && !STDOUT && !preserve_times(control, fd_in))) { + fatal("Failed to preserve times on output file\n"); + goto error; + } + if (unlikely(close(fd_in))) { fatal("Failed to close fd_in\n"); fd_in = -1; @@ -1264,8 +1269,10 @@ bool compress_file(rzip_control *control) free(control->outfile); return true; error: - if (STDIN && (fd_in > 0)) close(fd_in); - if ((!STDOUT) && (fd_out > 0)) close(fd_out); + if (STDIN && (fd_in > 0)) + close(fd_in); + if ((!STDOUT) && (fd_out > 0)) + close(fd_out); return false; }