]> git.eshelyaron.com Git - emacs.git/commitdiff
Merge from gnulib
authorPaul Eggert <eggert@cs.ucla.edu>
Wed, 15 Jul 2015 05:29:16 +0000 (22:29 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Wed, 15 Jul 2015 05:30:01 +0000 (22:30 -0700)
This incorporates:
2015-07-05 acl-permissions: Document FreeBSD ACL_TYPE_NFS4 acls
2015-07-05 acl-permissions: Fix on FreeBSD
2015-07-05 file-has-acl, acl-permissions: fix some more HP-UX typos
* lib/acl-internal.c, lib/acl-internal.h, lib/get-permissions.c:
* lib/set-permissions.c: Copy from gnulib.

lib/acl-internal.c
lib/acl-internal.h
lib/get-permissions.c
lib/set-permissions.c

index 1a2f8c44bf71dec09a1de90e4f5cf9172baafb26..1eaa671bd37942a93cfab3d2f46698e77830c087 100644 (file)
@@ -115,6 +115,13 @@ acl_access_nontrivial (acl_t acl)
 #  endif
 }
 
+int
+acl_default_nontrivial (acl_t acl)
+{
+  /* acl is non-trivial if it is non-empty.  */
+  return (acl_entries (acl) > 0);
+}
+
 # endif
 
 #elif USE_ACL && HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
index 4f042adc96be5b0e0586a58a6c7918cb87f3e33c..38a4ab2eb3aebf8e57b176df61b263703f013b58 100644 (file)
@@ -155,6 +155,12 @@ extern int acl_extended_nontrivial (acl_t);
    Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
    Return -1 and set errno upon failure to determine it.  */
 extern int acl_access_nontrivial (acl_t);
+
+/* ACL is an ACL, from a file, stored as type ACL_TYPE_DEFAULT.
+   Return 1 if the given ACL is non-trivial.
+   Return 0 if it is trivial, i.e. equivalent to a simple stat() mode.
+   Return -1 and set errno upon failure to determine it.  */
+extern int acl_default_nontrivial (acl_t);
 #  endif
 
 # elif HAVE_FACL && defined GETACL /* Solaris, Cygwin, not HP-UX */
index 6c6618df989ae8bba72df6e223d505af32b89cd1..459513c925144fa6be950cfeb2f9e204a69c0a9f 100644 (file)
@@ -60,6 +60,12 @@ get_permissions (const char *name, int desc, mode_t mode,
        return -1;
     }
 
+# if HAVE_ACL_TYPE_NFS4  /* FreeBSD */
+
+  /* TODO (see set_permissions). */
+
+# endif
+
 #  else /* HAVE_ACL_TYPE_EXTENDED */
   /* Mac OS X */
 
index 25c463d966d21c211305877654151cd1646f8a85..1aa5b4941c749d8bd91b97ec8a8fefce753c3d30 100644 (file)
@@ -530,7 +530,8 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
              *acls_set = true;
              if (S_ISDIR(ctx->mode))
                {
-                 if (! from_mode && ctx->default_acl)
+                 if (! from_mode && ctx->default_acl &&
+                     acl_default_nontrivial (ctx->default_acl))
                    ret = acl_set_file (name, ACL_TYPE_DEFAULT,
                                        ctx->default_acl);
                  else
@@ -540,6 +541,15 @@ set_acls (struct permission_context *ctx, const char *name, int desc,
        }
     }
 
+# if HAVE_ACL_TYPE_NFS4  /* FreeBSD */
+
+  /* File systems either support POSIX ACLs (for example, ufs) or NFS4 ACLs
+     (for example, zfs). */
+
+  /* TODO: Implement setting ACLs once get_permissions() reads them. */
+
+# endif
+
 #  else /* HAVE_ACL_TYPE_EXTENDED */
   /* Mac OS X */