From d3eee15f8421326450b05c2dcac1aea121a92073 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 17 Feb 2016 11:01:21 -0500 Subject: [PATCH] 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. --- src/rofiles-fuse/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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;