diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-15 15:40:45 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2019-06-15 15:40:45 +0000 |
commit | 5e5a80ace62c9488962cd3d6ec568e7b5645cf00 (patch) | |
tree | 7e57904b06bcae91cbfa13dc55b2830c8a6acf9c /lib/libc | |
parent | 8f2c725576d878b281de98e8e52a18e4c584a1bd (diff) |
realpath(3) doesn't use lstat(2), readlink(2), or getcwd(3) anymore,
it is a thin wrapper over the syscall __readlink(2). Improve the list
of possible errors.
ok millert beck jmc
Diffstat (limited to 'lib/libc')
-rw-r--r-- | lib/libc/stdlib/realpath.3 | 60 |
1 files changed, 39 insertions, 21 deletions
diff --git a/lib/libc/stdlib/realpath.3 b/lib/libc/stdlib/realpath.3 index 5966b380588..6e253c87a31 100644 --- a/lib/libc/stdlib/realpath.3 +++ b/lib/libc/stdlib/realpath.3 @@ -28,9 +28,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $OpenBSD: realpath.3,v 1.19 2014/01/20 22:40:06 schwarze Exp $ +.\" $OpenBSD: realpath.3,v 1.20 2019/06/15 15:40:44 deraadt Exp $ .\" -.Dd $Mdocdate: January 20 2014 $ +.Dd $Mdocdate: June 15 2019 $ .Dt REALPATH 3 .Os .Sh NAME @@ -96,13 +96,43 @@ are undefined. .Sh ERRORS The function .Fn realpath -may fail and set the external variable -.Va errno -for any of the errors specified for the library functions -.Xr lstat 2 , -.Xr readlink 2 , -and -.Xr getcwd 3 . +will fail if: +.Bl -tag -width Er +.It Bq Er EACCES +Read or search permission was denied for a component of +.Ar pathname . +.It Bq Er EINVAL +The +.Ar pathname +argument is a null pointer. +.It Bq Er EIO +An error occurred while reading from the file system. +.It Bq Er ELOOP +Too many symbolic links were encountered in translating +.Ar pathname . +.It Bq Er ENAMETOOLONG +A component of +.Ar pathname +exceeded +.Dv NAME_MAX +characters, or the entire +.Ar pathname +(including the terminating NUL) exceeded +.Dv PATH_MAX . +.It Bq Er ENAMETOOLONG +Pathname resolution of a symbolic link produced an intermediate +result whose length exceeds +.Dv PATH_MAX . +.It Bq Er ENOENT +A component of +.Ar pathname +does not name an existing file or +.Ar pathname +points to an empty string. +.It Bq Er ENOTDIR +A component of the path prefix is not a directory. +.It Bq Er ENOMEM +Sufficient storage space is unavailable for allocation. .Sh SEE ALSO .Xr readlink 1 , .Xr getcwd 3 @@ -116,15 +146,3 @@ The .Fn realpath function call first appeared in .Bx 4.4 . -.Sh CAVEATS -This implementation of -.Fn realpath -differs slightly from the Solaris implementation. -The -.Bx 4.4 -version always returns absolute pathnames, -whereas the Solaris implementation will, -under certain circumstances, return a relative -.Fa resolved -when given a relative -.Fa pathname . |