Next: readlinkat, Previous: readdir_r, Up: Function Substitutes [Contents][Index]
readlink
POSIX specification:
http://www.opengroup.org/onlinepubs/9699919799/functions/readlink.html
Gnulib module: readlink
Portability problems fixed by Gnulib:
readlink("link/",buf,len)
:
FreeBSD 7.2, Solaris 9, Mac OS X 10.10.
readlink
returns int
instead of
ssize_t
:
glibc 2.4, FreeBSD 6.0, OpenBSD 3.8, Cygwin 1.5.x, AIX 7.1.
Portability problems not fixed by Gnulib:
readlink
is called on a directory: In the case of NFS mounted
directories, Cygwin sets errno
to ENOENT
or EIO
instead of
EINVAL
. To avoid this problem, check for a directory before calling
readlink
.
readlink
is called on a file that is not a symbolic link:
Irix may set errno
to ENXIO
instead of EINVAL
. Cygwin
may set errno to EACCES
instead of EINVAL
.
errno
to ERANGE
rather than returning truncated
contents, and Linux sets errno
to EINVAL
if the
requested length is zero. Use the gnulib module areadlink for
improved ability to read symlink contents.