-/* $OpenBSD: fuse_vfsops.c,v 1.30 2017/12/11 05:27:40 deraadt Exp $ */
+/* $OpenBSD: fuse_vfsops.c,v 1.31 2018/01/04 10:51:11 mpi Exp $ */
/*
* Copyright (c) 2012-2013 Sylvestre Gallon <ccna.syl@gmail.com>
*
struct fusefs_args *args = data;
struct vnode *vp;
struct file *fp;
+ int error = 0;
if (mp->mnt_flag & MNT_UPDATE)
return (EOPNOTSUPP);
if ((fp = fd_getfile(p->p_fd, args->fd)) == NULL)
return (EBADF);
+ FREF(fp);
- if (fp->f_type != DTYPE_VNODE)
- return (EINVAL);
+ if (fp->f_type != DTYPE_VNODE) {
+ error = EINVAL;
+ goto bad;
+ }
vp = fp->f_data;
- if (vp->v_type != VCHR)
- return (EBADF);
+ if (vp->v_type != VCHR) {
+ error = EBADF;
+ goto bad;
+ }
fmp = malloc(sizeof(*fmp), M_FUSEFS, M_WAITOK | M_ZERO);
fmp->mp = mp;
/* cannot tsleep on mount */
fuse_device_queue_fbuf(fmp->dev, fbuf);
- return (0);
+bad:
+ FRELE(fp, p);
+ return (error);
}
int