Index: lib/libc/sys/read.2 =================================================================== --- lib/libc/sys/read.2 +++ lib/libc/sys/read.2 @@ -28,7 +28,7 @@ .\" @(#)read.2 8.4 (Berkeley) 2/26/94 .\" $FreeBSD$ .\" -.Dd March 30, 2020 +.Dd May 13, 2020 .Dt READ 2 .Os .Sh NAME @@ -199,9 +199,10 @@ The file was marked for non-blocking I/O, and no data were ready to be read. .It Bq Er EISDIR -The file descriptor is associated with a directory residing -on a file system that does not allow regular read operations on -directories (e.g.\& NFS). +The file descriptor is associated with a directory. +The +.Xr readdir 3 +function should be used instead. .It Bq Er EOPNOTSUPP The file descriptor is associated with a file system and file type that do not allow regular read operations on it. Index: sys/kern/vfs_vnops.c =================================================================== --- sys/kern/vfs_vnops.c +++ sys/kern/vfs_vnops.c @@ -792,6 +792,8 @@ uio->uio_td, td)); KASSERT(flags & FOF_OFFSET, ("No FOF_OFFSET")); vp = fp->f_vnode; + if (vp->v_type == VDIR) + return (EISDIR); ioflag = 0; if (fp->f_flag & FNONBLOCK) ioflag |= IO_NDELAY;