Index: sys/kern/kern_descrip.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_descrip.c,v retrieving revision 1.279.2.6 diff -u -d -r1.279.2.6 kern_descrip.c --- sys/kern/kern_descrip.c 23 Mar 2006 04:07:01 -0000 1.279.2.6 +++ sys/kern/kern_descrip.c 10 Feb 2008 20:58:40 -0000 @@ -2031,7 +2031,7 @@ int error; *vpp = NULL; - if ((error = _fget(td, fd, &fp, 0, 0)) != 0) + if ((error = _fget(td, fd, &fp, flags, 0)) != 0) return (error); if (fp->f_vnode == NULL) { error = EINVAL; Index: sys/kern/uipc_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_syscalls.c,v retrieving revision 1.221.2.1 diff -u -d -r1.221.2.1 uipc_syscalls.c --- sys/kern/uipc_syscalls.c 28 Dec 2005 19:30:41 -0000 1.221.2.1 +++ sys/kern/uipc_syscalls.c 10 Feb 2008 21:35:00 -0000 @@ -1762,7 +1762,7 @@ do_sendfile(struct thread *td, struct sendfile_args *uap, int compat) { struct vnode *vp; - struct vm_object *obj; + struct vm_object *obj = NULL; struct socket *so = NULL; struct mbuf *m, *m_header = NULL; struct sf_buf *sf; @@ -1783,7 +1783,8 @@ if ((error = fgetvp_read(td, uap->fd, &vp)) != 0) goto done; vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, td); - obj = vp->v_object; + if (vp->v_type == VREG) + obj = vp->v_object; VOP_UNLOCK(vp, 0, td); if (obj == NULL) { error = EINVAL;