From f2b4d05de722f58807fdf2518003515b143a26e3 Mon Sep 17 00:00:00 2001 From: Joel Rosdahl Date: Fri, 29 May 2020 20:38:26 +0200 Subject: [PATCH] Add missing O_TRUNC when opening destination file Should have been there in a16778a6243e271d501da95232cbe7c9ff58649b. --- src/util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/util.c b/src/util.c index eff2eed02..4aa99f424 100644 --- a/src/util.c +++ b/src/util.c @@ -333,7 +333,7 @@ copy_file(const char *src, cc_log("Copying %s to %s via %s (%scompressed)", src, dest, tmp_name, compress_level > 0 ? "" : "un"); } else { - fd_out = open(dest, O_WRONLY | O_CREAT | O_BINARY, 0666); + fd_out = open(dest, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, 0666); if (fd_out == -1) { saved_errno = errno; close(fd_out); -- 2.47.2