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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
Description:
renameatu() function: rename a file, relative to two dirs, with unsigned flag
Files:
lib/at-func2.c
lib/renameatu.c
lib/renameatu.h
m4/renameat.m4
Depends-on:
stdio
extensions
fcntl-h
filenamecat-lgpl [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
openat-h [test $HAVE_RENAMEAT = 0 || test $REPLACE_RENAMEAT = 1]
fstatat [test $REPLACE_RENAMEAT = 1]
readlinkat [test $REPLACE_RENAMEAT = 1]
stdbool [test $REPLACE_RENAMEAT = 1]
at-internal [test $HAVE_RENAMEAT = 0]
filename [test $HAVE_RENAMEAT = 0]
fstat [test $HAVE_RENAMEAT = 0]
getcwd-lgpl [test $HAVE_RENAMEAT = 0]
openat-die [test $HAVE_RENAMEAT = 0]
rename [test $HAVE_RENAMEAT = 0]
same-inode [test $HAVE_RENAMEAT = 0]
save-cwd [test $HAVE_RENAMEAT = 0]
stat [test $HAVE_RENAMEAT = 0]
configure.ac:
gl_FUNC_RENAMEAT
if test $HAVE_RENAMEAT = 0; then
AC_LIBOBJ([at-func2])
fi
Makefile.am:
lib_SOURCES += renameatu.c
Include:
"renameatu.h"
License:
GPL
Maintainer:
Jim Meyering, Eric Blake