summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/rofiles-fuse/main.c2
-rwxr-xr-xtests/test-rofiles-fuse.sh5
2 files changed, 5 insertions, 2 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;
}
diff --git a/tests/test-rofiles-fuse.sh b/tests/test-rofiles-fuse.sh
index d329d765..6222929e 100755
--- a/tests/test-rofiles-fuse.sh
+++ b/tests/test-rofiles-fuse.sh
@@ -26,7 +26,7 @@ skip_without_user_xattrs
setup_test_repository "bare"
-echo "1..7"
+echo "1..8"
cd ${test_tmpdir}
mkdir mnt
@@ -114,3 +114,6 @@ fi
assert_file_has_content err.txt "Unable to do hardlink checkout across devices"
echo "ok checkout copy fallback"
+
+# check that O_RDONLY|O_CREAT is handled correctly; used by flock(1) at least
+flock mnt/nonexistent-file echo "ok create file in ro mode"