From: Colin Walters Date: Wed, 17 Feb 2016 16:01:21 +0000 (-0500) Subject: rofiles-fuse: Fix truncate call to not use O_CREAT X-Git-Tag: archive/raspbian/2022.1-3+rpi1~1^2~4^2~55^2~22 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d3eee15f8421326450b05c2dcac1aea121a92073;p=ostree.git rofiles-fuse: Fix truncate call to not use O_CREAT I was getting a compilation error with the GCC hardening flags which look for a missing mode with `O_CREAT`. The right fix here is to drop `O_CREAT`, as truncate() should throw `ENOENT` if the file doesn't exist. --- diff --git a/src/rofiles-fuse/main.c b/src/rofiles-fuse/main.c index 004ad3d2..4337f00f 100644 --- a/src/rofiles-fuse/main.c +++ b/src/rofiles-fuse/main.c @@ -299,7 +299,7 @@ callback_truncate (const char *path, off_t size) path = ENSURE_RELPATH (path); VERIFY_WRITE(path); - fd = openat (basefd, path, O_RDWR | O_CREAT); + fd = openat (basefd, path, O_WRONLY); if (fd == -1) return -errno;