[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: fchmodat with AT_SYMLINK_NOFOLLOW
From: |
Bruno Haible |
Subject: |
Re: fchmodat with AT_SYMLINK_NOFOLLOW |
Date: |
Sun, 16 Feb 2020 19:52:21 +0100 |
User-agent: |
KMail/5.1.3 (Linux/4.4.0-171-generic; KDE/5.18.0; x86_64; ; ) |
On 2020-02-08 I wrote:
> 1) Improve the cross-compilation guesses. The result of the
> "fchmodat+AT_SYMLINK_NOFOLLOW works on non-symlinks" test is:
> - yes on kFreeBSD/glibc, Hurd/glibc, FreeBSD 12, AIX 7.2, Solaris 11, Haiku,
> - no on Linux/glibc, Cygwin 2.9.
A similar improvement can be done for lchmod. The result of the
"lchmod works on non-symlinks" test is:
- on Linux/glibc it is not executed, because lchmod() does not exist;
but if it would, it would surely report "no",
- "yes" on Linux with musl libc, GNU/kFreeBSD, GNU/Hurd, Mac OS X 10.5,
FreeBSD 12.0, NetBSD 8.0, HP-UX 11.31,
- "no" on no platform I know of (probably older musl libc versions).
2020-02-16 Bruno Haible <address@hidden>
lchmod: Improve cross-compilation guess.
* m4/lchmod.m4 (gl_FUNC_LCHMOD): Require AC_CANONICAL_HOST. When
cross-compiling, guess depending on the platform.
diff --git a/m4/lchmod.m4 b/m4/lchmod.m4
index 68dab7a..1646bd7 100644
--- a/m4/lchmod.m4
+++ b/m4/lchmod.m4
@@ -1,4 +1,4 @@
-#serial 4
+#serial 5
dnl Copyright (C) 2005-2006, 2008-2020 Free Software Foundation, Inc.
dnl This file is free software; the Free Software Foundation
@@ -15,6 +15,8 @@ AC_DEFUN([gl_FUNC_LCHMOD],
dnl Persuade glibc <sys/stat.h> to declare lchmod().
AC_REQUIRE([AC_USE_SYSTEM_EXTENSIONS])
+ AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
+
AC_CHECK_FUNCS_ONCE([fchmodat lchmod lstat])
if test "$ac_cv_func_lchmod" = no; then
HAVE_LCHMOD=0
@@ -56,7 +58,12 @@ AC_DEFUN([gl_FUNC_LCHMOD],
]])],
[gl_cv_func_lchmod_works=yes],
[gl_cv_func_lchmod_works=no],
- [gl_cv_func_lchmod_works=$gl_cross_guess_normal])
+ [case "$host_os" in
+ dnl Guess no on Linux with glibc, yes otherwise.
+ linux-gnu*) gl_cv_func_lchmod_works="guessing no" ;;
+ *) gl_cv_func_lchmod_works="$gl_cross_guess_normal" ;;
+ esac
+ ])
rm -f conftest.lchmod])
case $gl_cv_func_lchmod_works in
*yes) ;;