]> Savannah Git Hosting - gnulib.git/commit
readlink, readlinkat: add ERANGE portability
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Dec 2020 00:48:26 +0000 (16:48 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 14 Dec 2020 01:34:14 +0000 (17:34 -0800)
commita2549454801d432e480fc83a32a827e72212a1fb
tree4e9a19ba46ecf2b809f4730058e273ce17c12cf5
parent13f9414bd94dbac97d2a770700bbae9077c8827f
readlink, readlinkat: add ERANGE portability

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.
ChangeLog
doc/posix-functions/readlink.texi
doc/posix-functions/readlinkat.texi
lib/readlink.c
lib/readlinkat.c
m4/readlink.m4
m4/readlinkat.m4
modules/readlinkat