diff options
author | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-09-30 10:53:12 +0000 |
---|---|---|
committer | Jeremie Courreges-Anglas <jca@cvs.openbsd.org> | 2016-09-30 10:53:12 +0000 |
commit | d9f7eac08b3d3cde735673f8e8c2be9595a65ca2 (patch) | |
tree | 2dea33a2798d0e395d69cc9f7c3e21a37dd5a678 /lib/libc/sys | |
parent | ee0484bb84cb1f8ce467d72ec4ae27395853978a (diff) |
Make read(2) return EISDIR on directories.
Years ago Theo made read(2) return 0 on directories, instead of dumping
the directory content. Another behavior is allowed as an extension by
POSIX, returning an EISDIR error, as used on a few other systems. This
behavior is deemed more useful as it helps spotting errors. This
implies that it might break some setups.
Ports bulk builds by ajacoutot@ and naddy@, ok millert@ bluhm@ naddy@
deraadt@
Diffstat (limited to 'lib/libc/sys')
-rw-r--r-- | lib/libc/sys/read.2 | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/sys/read.2 b/lib/libc/sys/read.2 index 48e227354ee..07269801fe7 100644 --- a/lib/libc/sys/read.2 +++ b/lib/libc/sys/read.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: read.2,v 1.35 2015/02/05 02:33:09 schwarze Exp $ +.\" $OpenBSD: read.2,v 1.36 2016/09/30 10:53:11 jca Exp $ .\" $NetBSD: read.2,v 1.6 1995/02/27 12:35:47 cgd Exp $ .\" .\" Copyright (c) 1980, 1991, 1993 @@ -30,7 +30,7 @@ .\" .\" @(#)read.2 8.4 (Berkeley) 2/26/94 .\" -.Dd $Mdocdate: February 5 2015 $ +.Dd $Mdocdate: September 30 2016 $ .Dt READ 2 .Os .Sh NAME @@ -152,13 +152,15 @@ is not a valid file or socket descriptor open for reading. Part of .Fa buf points outside the process's allocated address space. -.It Bq Er EIO -An I/O error occurred while reading from the file system. .It Bq Er EINTR A read from a slow device (i.e. one that might block for an arbitrary amount of time) was interrupted by the delivery of a signal before any data arrived. +.It Bq Er EIO +An I/O error occurred while reading from the file system. +.It Bq Er EISDIR +The underlying file is a directory. .El .Pp In addition, |