diff options
author | Nikolaus Rath <Nikolaus@rath.org> | 2017-04-07 16:36:52 -0700 |
---|---|---|
committer | Nikolaus Rath <Nikolaus@rath.org> | 2017-04-07 16:40:15 -0700 |
commit | 20b24a16e10c8b5bb0535e9f06c40cf74ed8aabe (patch) | |
tree | 6db350a80c0621ce9fb1319b45c6d25b8dd5d308 /example | |
parent | 09862556887caf32b37aa0caa412c467f7f5a40e (diff) |
passthrough: implemented create()
This allows calls like open(file, O_CREAT|O_RDONLY, 0200) which would
otherwise fail because we cannot open the file after mknod() has
created it with 0200 permissions.
Diffstat (limited to 'example')
-rw-r--r-- | example/passthrough.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/example/passthrough.c b/example/passthrough.c index d5edc04..0c635ca 100644 --- a/example/passthrough.c +++ b/example/passthrough.c @@ -278,6 +278,19 @@ static int xmp_utimens(const char *path, const struct timespec ts[2], } #endif +static int xmp_create(const char *path, mode_t mode, + struct fuse_file_info *fi) +{ + int res; + + res = open(path, fi->flags, mode); + if (res == -1) + return -errno; + + fi->fh = res; + return 0; +} + static int xmp_open(const char *path, struct fuse_file_info *fi) { int res; @@ -452,6 +465,7 @@ static struct fuse_operations xmp_oper = { .utimens = xmp_utimens, #endif .open = xmp_open, + .create = xmp_create, .read = xmp_read, .write = xmp_write, .statfs = xmp_statfs, |