summaryrefslogtreecommitdiff
path: root/lib/libfuse/fuse_ops.c
diff options
context:
space:
mode:
authorSylvestre Gallon <syl@cvs.openbsd.org>2014-01-20 11:52:56 +0000
committerSylvestre Gallon <syl@cvs.openbsd.org>2014-01-20 11:52:56 +0000
commit2bf58a9b64067b8e7b7537e40ca3113026075449 (patch)
tree5602f189aea0e8ea42a38ae26b69ec5d7eb58835 /lib/libfuse/fuse_ops.c
parent2fa9841b19a0fc11df0192724f6b98e8b647e4bb (diff)
hook mknod() if create() implementation is not present.
from Derrik Pates (daemon AT now DOT ai), thanks! ok guenther@
Diffstat (limited to 'lib/libfuse/fuse_ops.c')
-rw-r--r--lib/libfuse/fuse_ops.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/libfuse/fuse_ops.c b/lib/libfuse/fuse_ops.c
index 23e6e92d867..05d21ca8de1 100644
--- a/lib/libfuse/fuse_ops.c
+++ b/lib/libfuse/fuse_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_ops.c,v 1.20 2014/01/16 09:31:44 syl Exp $ */
+/* $OpenBSD: fuse_ops.c,v 1.21 2014/01/20 11:52:55 syl Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -496,7 +496,8 @@ ifuse_ops_create(struct fuse *f, struct fusebuf *fbuf)
char *realname;
- CHECK_OPT(create);
+ DPRINTF("Opcode:\tcreate\n");
+ DPRINTF("Inode:\t%llu\n", (unsigned long long)fbuf->fb_ino);
bzero(&ffi, sizeof(ffi));
ffi.flags = fbuf->fb_io_flags;
@@ -505,7 +506,12 @@ ifuse_ops_create(struct fuse *f, struct fusebuf *fbuf)
free(fbuf->fb_dat);
realname = build_realname(f, vn->ino);
- fbuf->fb_err = f->op.create(realname, mode, &ffi);
+ if (f->op.create)
+ fbuf->fb_err = f->op.create(realname, mode, &ffi);
+ else if (f->op.mknod)
+ fbuf->fb_err = f->op.mknod(realname, S_IFREG | mode, 0);
+ else
+ fbuf->fb_err = -ENOSYS;
if (!fbuf->fb_err) {
fbuf->fb_err = update_vattr(f, &fbuf->fb_vattr, realname, vn);