Fix some portability issues with Gnulib's readlink and readlinkat,
notably mostly working around the ERANGE problem in AIX and HP-UX.
* doc/posix-functions/readlink.texi:
* doc/posix-functions/readlinkat.texi:
ERANGE problem is mostly fixed now. Mention AIX problem with
trailing / and EINVAL. Lessen differences between these two files.
* lib/readlink.c (rpl_readlink):
* lib/readlinkat.c (rpl_readlinkat):
If stat ("FILE/", ...) reports EOVERFLOW, treat FILE/ as an
existing directory. Mostly work around READLINK_TRUNCATE BUG.
Lessen spurious differences between the readlink and readlinkat code.
* lib/readlinkat.c (rpl_readlinkat):
Fix bug where stat was used where fstatat was intended.
* m4/readlink.m4 (gl_FUNC_READLINK):
Rename gl_cv_func_readlink_works to gl_cv_func_readlink_trailing_slash
to identify readlink problems more precisely. All uses changed.
Guess no on AIX or HP-UX for this variable.
Add check for whether readlink truncates results,
and define new macro READLINK_TRUCATE_BUG accordingly.
* m4/readlinkat.m4 (gl_FUNC_READLINKAT):
Also check gl_cv_func_readlink_trailing_slash when deciding
whether to replace readlinkat.
* modules/readlinkat (Depends-on): Most dependencies are also
needed if replacing readlinkat. fstatat is different, as it
is needed only if replacing an existing readlinkat.