aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-08-22 02:00:11 +0200
committerXavier Del Campo Romero <xavi.dcr@tutanota.com>2024-08-22 02:00:11 +0200
commit36dec4c1b495cd13542827e7ab98b7938adb1524 (patch)
tree1d077e921f397820fc52ca21c55668d5b6daeebb
parentd73097dd74625711dd02d5e3a6cb6bdca5ca8150 (diff)
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.
-rw-r--r--main.c2
1 files changed, 1 insertions, 1 deletions
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)