]> Savannah Git Hosting - gnulib.git/commitdiff
file-has-acl: minor refactor of acl_get_link_np fix
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Nov 2024 15:52:32 +0000 (07:52 -0800)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 11 Nov 2024 15:53:27 +0000 (07:53 -0800)
* lib/file-has-acl.c (file_has_aclinfo): Redo to avoid ‘else #endif’.

ChangeLog
lib/file-has-acl.c

index 3ae5107c7ae44ebd64f64f4f111ab8ccb27b8618..4a7b8a7c14de1eb5b83ea7e8abc683885d4defa5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2024-11-11  Paul Eggert  <eggert@cs.ucla.edu>
 
+       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
index 2cbc20b38d8f991bc8cff544d8cf37ca53f0adf8..1cd979541649a0cb0619228a6d67bd16a51a6baf 100644 (file)
@@ -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);