diff options
| author | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-08-22 02:00:11 +0200 |
|---|---|---|
| committer | Xavier Del Campo Romero <xavi.dcr@tutanota.com> | 2024-08-22 02:00:11 +0200 |
| commit | 36dec4c1b495cd13542827e7ab98b7938adb1524 (patch) | |
| tree | 1d077e921f397820fc52ca21c55668d5b6daeebb | |
| parent | d73097dd74625711dd02d5e3a6cb6bdca5ca8150 (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.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -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) |
