readlink ¶POSIX specification:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/readlink.html
Portability problems fixed by Gnulib:
int instead of
ssize_t:
glibc 2.4, FreeBSD 6.0, OpenBSD 7.5, Cygwin 1.5.x, AIX 7.1.
Portability problems mostly fixed by Gnulib:
errno to
ERANGE rather than returning truncated contents:
AIX 7.2, HP-UX 11.
The Gnulib replacement normally works as POSIX requires by returning
the truncated contents. However, if the full link contents are
unreasonably large (more than 4000 bytes) the replacement clears the
entire buffer and returns the buffer size; although this is not a
complete fix, it suffices for typical callers, which ignore the buffer
contents anyway.
Portability problems not fixed by Gnulib:
errno to ENOENT or EIO instead of
EINVAL. To avoid this problem, check for a directory before calling
this function.
EACCES instead of EINVAL.
errno to EINVAL:
AIX 7.2.
errno to EINVAL if the
requested length is zero.
Use the gnulib module areadlink for
improved ability to read symlink contents.