diff options
Diffstat (limited to 'sys/fs/fdescfs/fdesc_vnops.c')
-rw-r--r-- | sys/fs/fdescfs/fdesc_vnops.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/sys/fs/fdescfs/fdesc_vnops.c b/sys/fs/fdescfs/fdesc_vnops.c index 676ea5de12b8..c1188c3819e7 100644 --- a/sys/fs/fdescfs/fdesc_vnops.c +++ b/sys/fs/fdescfs/fdesc_vnops.c @@ -196,7 +196,7 @@ loop: if (error != 0) { vgone(vp); vput(vp); - *vpp = NULLVP; + *vpp = NULL; return (error); } @@ -211,7 +211,7 @@ loop: mtx_unlock(&fdesc_hashmtx); vgone(vp); vput(vp); - *vpp = NULLVP; + *vpp = NULL; return (-1); } @@ -227,7 +227,7 @@ loop: vput(vp); /* If we didn't get it, return no vnode. */ if (error) - vp2 = NULLVP; + vp2 = NULL; *vpp = vp2; return (error); } @@ -301,7 +301,7 @@ fdesc_lookup(struct vop_lookup_args *ap) if (cnp->cn_namelen == 1 && *pname == '.') { *vpp = dvp; - VREF(dvp); + vref(dvp); return (0); } @@ -547,6 +547,8 @@ fdesc_readdir(struct vop_readdir_args *ap) fmp = VFSTOFDESC(ap->a_vp->v_mount); if (ap->a_ncookies != NULL) *ap->a_ncookies = 0; + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 0; off = (int)uio->uio_offset; if (off != uio->uio_offset || off < 0 || (u_int)off % UIO_MX != 0 || @@ -559,7 +561,12 @@ fdesc_readdir(struct vop_readdir_args *ap) fcnt = i - 2; /* The first two nodes are `.' and `..' */ FILEDESC_SLOCK(fdp); - while (i < fdp->fd_nfiles + 2 && uio->uio_resid >= UIO_MX) { + while (uio->uio_resid >= UIO_MX) { + if (i >= fdp->fd_nfiles + 2) { + if (ap->a_eofflag != NULL) + *ap->a_eofflag = 1; + break; + } bzero((caddr_t)dp, UIO_MX); switch (i) { case 0: /* `.' */ |