[ostree] rofiles-fuse: Fix truncate call to not use O_CREAT



commit d3eee15f8421326450b05c2dcac1aea121a92073
Author: Colin Walters <walters verbum org>
Date:   Wed Feb 17 11:01:21 2016 -0500

    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 files changed, 1 insertions(+), 1 deletions(-)
---
diff --git a/src/rofiles-fuse/main.c b/src/rofiles-fuse/main.c
index 004ad3d..4337f00 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;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]