On 2024-11-10 22:25, Bruno Haible wrote:
../../gllib/file-has-acl.c:427:21: error: 'acl_get_link_np' undeclared (first 
use in this function)
   427 |                   : acl_get_link_np)
       |                     ^~~~~~~~~~~~~~~

Thanks for fixing those bugs. For the Cygwin issue, I am easily confused by "else" immediately followed by "#endif" or "#else" or "#elif", and so installed the attached further patch which is merely a refactoring.
From 9dac7a63cb074ab459405cadc1b135b11af3e71b Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email protected]>
Date: Mon, 11 Nov 2024 07:52:32 -0800
Subject: [PATCH] file-has-acl: minor refactor of acl_get_link_np fix
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lib/file-has-acl.c (file_has_aclinfo): Redo to avoid ‘else #endif’.
---
 ChangeLog          |  3 +++
 lib/file-has-acl.c | 12 ++++++------
 2 files changed, 9 insertions(+), 6 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 3ae5107c7a..4a7b8a7c14 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2024-11-11  Paul Eggert  <[email protected]>
 
+	file-has-acl: minor refactor of acl_get_link_np fix
+	* lib/file-has-acl.c (file_has_aclinfo): Redo to avoid ‘else #endif’.
+
 	file-has-acl: scontext even if --disable-acl
 	Be able to get the security context even if configured with
 	--disable-acl, as security contexts are not ACLs, and the
diff --git a/lib/file-has-acl.c b/lib/file-has-acl.c
index 2cbc20b38d..1cd9795416 100644
--- a/lib/file-has-acl.c
+++ b/lib/file-has-acl.c
@@ -429,13 +429,13 @@ file_has_aclinfo (MAYBE_UNUSED char const *restrict name,
     else
       ret = -1;
 #   else /* FreeBSD, NetBSD >= 10, IRIX, Tru64, Cygwin >= 2.5 */
-    acl_t acl;
-#    if HAVE_ACL_GET_LINK_NP /* FreeBSD, NetBSD >= 10 */
-    if (!(flags & ACL_SYMLINK_FOLLOW))
-      acl = acl_get_link_np (name, ACL_TYPE_ACCESS);
-    else
+#    if !HAVE_ACL_GET_LINK_NP /* IRIX, Tru64, Cygwin >= 2.5 */
+#     define acl_get_link_np acl_get_file
 #    endif
-      acl = acl_get_file (name, ACL_TYPE_ACCESS);
+    acl_t acl = ((flags & AC_SYMLINK_FOLLOW
+                  ? acl_get_file
+                  : acl_get_link_np)
+                 (name, ACL_TYPE_ACCESS));
     if (acl)
       {
         ret = acl_access_nontrivial (acl);
-- 
2.43.0

Reply via email to