From 48ac9c526f7f09594891f88afe511c833c0500d1 Mon Sep 17 00:00:00 2001 From: Philipp Kaeser Date: Sat, 3 Oct 2026 15:39:28 +0200 Subject: [PATCH] log: Truncates the log file on creation. --- src/log.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/log.c b/src/log.c index a54e195..30efbe9 100644 --- a/src/log.c +++ b/src/log.c @@ -80,10 +80,10 @@ bool bs_log_init_file( } // Now, actually create it. - int fd = open(path, O_CREAT | O_WRONLY, S_IWUSR | S_IRUSR); + int fd = open(path, O_CREAT|O_WRONLY|O_TRUNC, S_IWUSR|S_IRUSR); if (0 > fd) { bs_log(BS_ERROR | BS_ERRNO, - "Failed open(%s, O_CREATE | O_WRONLY, S_IWUSR | S_IRUSR)", + "Failed open(%s, O_CREATE|O_WRONLY|O_TRUNC, S_IWUSR|S_IRUSR)", path); return false; }