summaryrefslogtreecommitdiff
path: root/lib/libfuse
diff options
context:
space:
mode:
authorSylvestre Gallon <syl@cvs.openbsd.org>2013-12-20 22:03:27 +0000
committerSylvestre Gallon <syl@cvs.openbsd.org>2013-12-20 22:03:27 +0000
commit985f5e780d4916af79960389fa5a9297a6fcab47 (patch)
tree2a22661a064395d4ec27394ceca60d267f5052e6 /lib/libfuse
parente0dd152a3bdf42702910b6fc21950072e963e8e4 (diff)
Add support for truncate in fuse.
Input from millert@. Ok millert@, tedu@.
Diffstat (limited to 'lib/libfuse')
-rw-r--r--lib/libfuse/fuse_ops.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/libfuse/fuse_ops.c b/lib/libfuse/fuse_ops.c
index 3230b4ecc40..13fbcb629fd 100644
--- a/lib/libfuse/fuse_ops.c
+++ b/lib/libfuse/fuse_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_ops.c,v 1.17 2013/12/09 14:59:08 beck Exp $ */
+/* $OpenBSD: fuse_ops.c,v 1.18 2013/12/20 22:03:26 syl Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -700,6 +700,14 @@ ifuse_ops_setattr(struct fuse *f, struct fusebuf *fbuf)
fbuf->fb_err = -ENOSYS;
}
+ if (!fbuf->fb_err && (io->fi_flags & FUSE_FATTR_SIZE)) {
+ if (f->op.truncate)
+ fbuf->fb_err = f->op.truncate(realname,
+ fbuf->fb_vattr.va_size);
+ else
+ fbuf->fb_err = -ENOSYS;
+ }
+
bzero(&fbuf->fb_vattr, sizeof(fbuf->fb_vattr));
if (!fbuf->fb_err)