Hash :
d682f8de
Author :
Date :
2022-06-12T13:46:52
fchmodat: port better to MS-Windows etc. MS-Windows problem reported by Bruno Haible in: https://lists.gnu.org/r/bug-gnulib/2022-06/msg00041.html Although I don’t use MS-Windows I see some related fstatat etc. problems and am trying to fix them with this further patch. * lib/fchmodat.c (fchmodat): * lib/lchmod.c (lchmod): * lib/lchown.c (lchown) [!HAVE_LCHOWN && HAVE_CHOWN && !CHOWN_MODIFIES_SYMLINK]: * lib/renameatu.c (renameatu) [HAVE_RENAME && RENAME_TRAILING_SLASH_SOURCE_BUG]: Use readlinkat/readlink instead of fstatat/lstat to test merely whether a string names a symlink, as this avoids problems with EOVERFLOW. Also, I hope it works around the MS-Windows issues that Bruno noted. * m4/fchmodat.m4 (gl_PREREQ_FCHMODAT): Check for readlinkat, not lchmod. * m4/lchmod.m4 (gl_FUNC_LCHMOD): Do not require AC_CANONICAL_HOST or check for lstat. (gl_PREREQ_LCHMOD): Check for readlink. * modules/lchown (Depends-on): Add readlink. Do not depend on lstat merely because !HAVE_LCHOWN. * modules/renameatu (Depends-on): Add fstatat, readlinkat.
Description:
lchown() function: change ownership of a file, without following symlinks.
Files:
lib/lchown.c
m4/lchown.m4
Depends-on:
unistd
readlink [test $HAVE_LCHOWN = 0]
chown [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
errno [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
stdbool [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
sys_stat [test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1]
lstat [test $REPLACE_LCHOWN = 1]
configure.ac:
gl_FUNC_LCHOWN
gl_CONDITIONAL([GL_COND_OBJ_LCHOWN],
[test $HAVE_LCHOWN = 0 || test $REPLACE_LCHOWN = 1])
gl_UNISTD_MODULE_INDICATOR([lchown])
Makefile.am:
if GL_COND_OBJ_LCHOWN
lib_SOURCES += lchown.c
endif
Include:
<unistd.h>
License:
LGPLv2+
Maintainer:
Jim Meyering, Eric Blake