summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/libfuse/fuse_ops.c4
-rw-r--r--sys/miscfs/fuse/fuse_vnops.c13
2 files changed, 13 insertions, 4 deletions
diff --git a/lib/libfuse/fuse_ops.c b/lib/libfuse/fuse_ops.c
index c35209757d3..2f0fdc6bc4a 100644
--- a/lib/libfuse/fuse_ops.c
+++ b/lib/libfuse/fuse_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_ops.c,v 1.22 2014/01/23 12:29:38 syl Exp $ */
+/* $OpenBSD: fuse_ops.c,v 1.23 2014/01/29 20:37:18 syl Exp $ */
/*
* Copyright (c) 2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -64,8 +64,6 @@ update_vattr(struct fuse *f, struct vattr *attr, const char *realname,
st.st_blksize = 512;
if (st.st_blocks == 0)
st.st_blocks = 4;
- if (st.st_size == 0)
- st.st_size = 512;
st.st_ino = vn->ino;
diff --git a/sys/miscfs/fuse/fuse_vnops.c b/sys/miscfs/fuse/fuse_vnops.c
index 6d514bb203d..f5fb08a6dd5 100644
--- a/sys/miscfs/fuse/fuse_vnops.c
+++ b/sys/miscfs/fuse/fuse_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fuse_vnops.c,v 1.13 2014/01/16 09:31:44 syl Exp $ */
+/* $OpenBSD: fuse_vnops.c,v 1.14 2014/01/29 20:37:18 syl Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
@@ -23,6 +23,7 @@
#include <sys/mount.h>
#include <sys/namei.h>
#include <sys/poll.h>
+#include <sys/proc.h>
#include <sys/specdev.h>
#include <sys/statvfs.h>
#include <sys/vnode.h>
@@ -1011,6 +1012,9 @@ fusefs_write(void *v)
struct vnode *vp = ap->a_vp;
struct uio *uio = ap->a_uio;
struct proc *p = uio->uio_procp;
+ struct ucred *cred = p->p_ucred;
+ struct vattr vattr;
+ int ioflag = ap->a_ioflag;
struct fusefs_node *ip;
struct fusefs_mnt *fmp;
struct fusebuf *fbuf = NULL;
@@ -1025,6 +1029,13 @@ fusefs_write(void *v)
if (uio->uio_resid == 0)
return (error);
+ if (ioflag & IO_APPEND) {
+ if ((error = VOP_GETATTR(vp, &vattr, cred, p)) != 0)
+ return (error);
+
+ uio->uio_offset = vattr.va_size;
+ }
+
while (uio->uio_resid > 0) {
len = MIN(uio->uio_resid, FUSEBUFMAXSIZE);
fbuf = fb_setup(len, ip->ufs_ino.i_number, FBT_WRITE, p);