From 36dec4c1b495cd13542827e7ab98b7938adb1524 Mon Sep 17 00:00:00 2001 From: Xavier Del Campo Romero Date: Thu, 22 Aug 2024 02:00:11 +0200 Subject: main.c: Fix missing O_TRUNC Otherwise, uploaded files meant to overwrite an existing file would not be updated accordingly if their newer size was smaller. --- main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.c b/main.c index 9bdfc58..19590ad 100644 --- a/main.c +++ b/main.c @@ -1081,7 +1081,7 @@ static int move_file(const char *const old, const char *const new) { int ret = -1; const int fd_old = open(old, O_RDONLY), - fd_new = open(new, O_WRONLY | O_CREAT, 0600); + fd_new = open(new, O_WRONLY | O_TRUNC | O_CREAT, 0600); struct stat sb; if (fd_old < 0) -- cgit v1.2.3