changeset 18046:7f8f2a88bb1f

set-permissions.c: adjust acl_from_mode's cpp guard * lib/set-permissions.c (acl_from_mode): Guard with #ifdef directives identical to those guarding the sole use. Otherwise, on some systems, we'd get a warning about the function being defined but not used. Also, filter through cppi to correct misleading indentation of cpp directives.
author Jim Meyering <meyering@fb.com>
date Fri, 03 Jul 2015 14:58:19 -0700
parents 036929d7bacd
children 6303ffca4ba4
files ChangeLog lib/set-permissions.c
diffstat 2 files changed, 25 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2015-07-03  Jim Meyering  <meyering@fb.com>
+
+	set-permissions.c: adjust acl_from_mode's cpp guard
+	* lib/set-permissions.c (acl_from_mode): Guard with #ifdef
+	directives identical to those guarding the sole use.
+	Otherwise, on some systems, we'd get a warning about
+	the function being defined but not used.
+	Also, filter through cppi to correct misleading indentation
+	of cpp directives.
+
 2015-07-03  Pádraig Brady  <P@draigBrady.com>
 
 	tests: restrict shells to those that support 'local'
--- a/lib/set-permissions.c
+++ b/lib/set-permissions.c
@@ -25,6 +25,8 @@
 
 #if USE_ACL
 # if ! defined HAVE_ACL_FROM_MODE && defined HAVE_ACL_FROM_TEXT /* FreeBSD, IRIX, Tru64 */
+#  if HAVE_ACL_GET_FILE && !HAVE_ACL_TYPE_EXTENDED
+
 static acl_t
 acl_from_mode (mode_t mode)
 {
@@ -46,6 +48,7 @@
 
   return acl_from_text (acl_text);
 }
+#  endif
 # endif
 
 # if HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
@@ -269,7 +272,7 @@
   }
 }
 
-#elif HAVE_GETACL /* HP-UX */
+# elif HAVE_GETACL /* HP-UX */
 static int
 context_acl_from_mode (struct permission_context *ctx, const char *name, int desc)
 {
@@ -321,7 +324,7 @@
     abort ();
   return ret;
 }
-#endif
+#  endif
 
 # elif HAVE_ACLX_GET && defined ACL_AIX_WIP /* AIX */
 static int
@@ -483,18 +486,18 @@
 {
   int ret = 0;
 
-#if HAVE_ACL_GET_FILE
+# if HAVE_ACL_GET_FILE
   /* POSIX 1003.1e (draft 17 -- abandoned) specific version.  */
   /* Linux, FreeBSD, Mac OS X, IRIX, Tru64 */
 #  if !HAVE_ACL_TYPE_EXTENDED
   /* Linux, FreeBSD, IRIX, Tru64 */
 
-#    ifndef HAVE_ACL_FROM_TEXT
-#     error Must have acl_from_text (see POSIX 1003.1e draft 17).
-#    endif
-#    ifndef HAVE_ACL_DELETE_DEF_FILE
-#     error Must have acl_delete_def_file (see POSIX 1003.1e draft 17).
-#    endif
+#   ifndef HAVE_ACL_FROM_TEXT
+#    error Must have acl_from_text (see POSIX 1003.1e draft 17).
+#   endif
+#   ifndef HAVE_ACL_DELETE_DEF_FILE
+#    error Must have acl_delete_def_file (see POSIX 1003.1e draft 17).
+#   endif
 
   if (! ctx->acls_not_supported)
     {
@@ -641,9 +644,9 @@
       else
 	*acls_set = true;
     }
-# endif
+#  endif
 
-#elif HAVE_GETACL /* HP-UX */
+# elif HAVE_GETACL /* HP-UX */
 
   if (from_mode)
     ret = context_acl_from_mode (ctx, name, desc);
@@ -730,7 +733,7 @@
 
   /* Nothing to do. */
 
-#endif
+# endif
 
   return ret;
 }