From 6eacbbe17ea7a7f523240400821a911589486d25 Mon Sep 17 00:00:00 2001 From: "Rafael G. Martins" Date: Mon, 8 May 2017 02:53:24 +0200 Subject: make: copy: truncate dest file if exists --- src/blogc-make/exec-native.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/blogc-make/exec-native.c b/src/blogc-make/exec-native.c index 08484cd..a02cd26 100644 --- a/src/blogc-make/exec-native.c +++ b/src/blogc-make/exec-native.c @@ -58,7 +58,7 @@ bm_exec_native_cp(bm_filectx_t *source, bm_filectx_t *dest, bool verbose) return 3; } - int fd_to = open(dest->path, O_WRONLY | O_CREAT, 0666); + int fd_to = open(dest->path, O_WRONLY | O_CREAT | O_TRUNC, 0666); if (fd_to < 0) { fprintf(stderr, "blogc-make: error: failed to open destination file to " "copy (%s): %s\n", dest->path, strerror(errno)); -- cgit v1.2.3-18-g5258