summaryrefslogtreecommitdiff
path: root/sys/kern/vfs_vnops.c
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-04 08:24:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1997-08-04 08:24:55 +0000
commit6aa02c92996304dfbe4fc528b8c073de88c67758 (patch)
tree6e87c129e5019fb68e6478f3f0edc17548bb8f00 /sys/kern/vfs_vnops.c
parent3a4c4b2fbdc7a3f8ce2e56b7a397d48e05fa1aaf (diff)
let us all try this for a while, and argue amongst ourselves.
make a read(2) on an open'd directory return 0 bytes. always.
Diffstat (limited to 'sys/kern/vfs_vnops.c')
-rw-r--r--sys/kern/vfs_vnops.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index 95ef459277a..b99a001a165 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfs_vnops.c,v 1.4 1997/07/15 16:06:17 deraadt Exp $ */
+/* $OpenBSD: vfs_vnops.c,v 1.5 1997/08/04 08:24:54 deraadt Exp $ */
/* $NetBSD: vfs_vnops.c,v 1.20 1996/02/04 02:18:41 christos Exp $ */
/*
@@ -260,14 +260,15 @@ vn_read(fp, uio, cred)
struct ucred *cred;
{
register struct vnode *vp = (struct vnode *)fp->f_data;
- int count, error;
+ int count, error = 0;
VOP_LEASE(vp, uio->uio_procp, cred, LEASE_READ);
VOP_LOCK(vp);
uio->uio_offset = fp->f_offset;
count = uio->uio_resid;
- error = VOP_READ(vp, uio, (fp->f_flag & FNONBLOCK) ? IO_NDELAY : 0,
- cred);
+ if (vp->v_type != VDIR)
+ error = VOP_READ(vp, uio,
+ (fp->f_flag & FNONBLOCK) ? IO_NDELAY : 0, cred);
fp->f_offset += count - uio->uio_resid;
VOP_UNLOCK(vp);
return (error);