2 @section @code{readlink}
5 POSIX specification:@* @url{http://www.opengroup.org/onlinepubs/9699919799/functions/readlink.html}
7 Gnulib module: readlink
9 Portability problems fixed by Gnulib:
12 Some platforms mistakenly succeed on @code{readlink("link/",buf,len)}:
13 FreeBSD 7.2, Solaris 9.
15 On some platforms, @code{readlink} returns @code{int} instead of
17 glibc 2.4, FreeBSD 6.0, OpenBSD 3.8, Cygwin 1.5.x, AIX 7.1.
19 This function is missing on some platforms:
23 Portability problems not fixed by Gnulib:
26 When @code{readlink} is called on a directory: In the case of NFS mounted
27 directories, Cygwin sets @code{errno} to @code{ENOENT} or @code{EIO} instead of
28 @code{EINVAL}. To avoid this problem, check for a directory before calling
31 When @code{readlink} is called on a file that is not a symbolic link:
32 Irix may set @code{errno} to @code{ENXIO} instead of @code{EINVAL}. Cygwin
33 may set errno to @code{EACCES} instead of @code{EINVAL}.
35 Symlink contents do not always have a trailing null byte, and there is
36 no indication if symlink contents were truncated if the return value
37 matches the length. Furthermore, AIX 5.1 and HP-UX 11 set
38 @code{errno} to @code{ERANGE} rather than returning truncated
39 contents, and Linux sets @code{errno} to @code{EINVAL} if the
40 requested length is zero. Use the gnulib module areadlink for
41 improved ability to read symlink contents.