summaryrefslogtreecommitdiff
path: root/src/rofiles-fuse
diff options
context:
space:
mode:
authorJonathan Lebon <jlebon@redhat.com>2017-09-20 18:38:16 +0000
committerAtomic Bot <atomic-devel@projectatomic.io>2017-09-21 16:51:15 +0000
commitd4c7093e370843c57eab2f89f0c39ef449e6b32e (patch)
tree435146371ac41e2f074c4a7e9ee92d47869fa765 /src/rofiles-fuse
parent3f8f878fa38d9b515544be08ed5df4127dc1bc12 (diff)
downloadostree-d4c7093e370843c57eab2f89f0c39ef449e6b32e.tar.gz
rofiles-fuse: also pass mode for O_RDONLY
In the `O_RDONLY` case, we were calling `openat` without a mode argument. However, it's perfectly legal (albeit unusual) to do `open(O_RDONLY|O_CREAT)`. One such application that makes use of this is `flock(1)`. This was actually caught by `_FORTIFY_SOURCE=2`, and once we run `rofiles-fuse` with `-f`, the message is clear: ``` *** invalid openat64 call: O_CREAT or O_TMPFILE without mode ***: rofiles-fuse terminated ======= Backtrace: ========= /lib64/libc.so.6(+0x7c8dc)[0x7f36d9f188dc] /lib64/libc.so.6(__fortify_fail+0x37)[0x7f36d9fbfaa7] /lib64/libc.so.6(+0x10019a)[0x7f36d9f9c19a] rofiles-fuse[0x401768] ... ``` Without `_FORTIFY_SOURCE`, the file gets created, but its mode is completely random. I ran into this while investigating https://github.com/projectatomic/rpm-ostree/pull/1003. Closes: #1200 Approved by: cgwalters
Diffstat (limited to 'src/rofiles-fuse')
-rw-r--r--src/rofiles-fuse/main.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/rofiles-fuse/main.c b/src/rofiles-fuse/main.c
index 6deaa6d0..f2b1b650 100644
--- a/src/rofiles-fuse/main.c
+++ b/src/rofiles-fuse/main.c
@@ -313,7 +313,7 @@ do_open (const char *path, mode_t mode, struct fuse_file_info *finfo)
if ((finfo->flags & O_ACCMODE) == O_RDONLY)
{
/* Read */
- fd = openat (basefd, path, finfo->flags);
+ fd = openat (basefd, path, finfo->flags, mode);
if (fd == -1)
return -errno;
}