Author: trasz
Date: Thu Oct  4 08:26:49 2012
New Revision: 241184
URL: http://svn.freebsd.org/changeset/base/241184

Log:
  MFC r240083:
  
  Make setfacl(1) behave properly in situations like "setfacl -kd".

Modified:
  stable/9/bin/setfacl/setfacl.c
Directory Properties:
  stable/9/bin/setfacl/   (props changed)

Modified: stable/9/bin/setfacl/setfacl.c
==============================================================================
--- stable/9/bin/setfacl/setfacl.c      Thu Oct  4 07:40:55 2012        
(r241183)
+++ stable/9/bin/setfacl/setfacl.c      Thu Oct  4 08:26:49 2012        
(r241184)
@@ -73,6 +73,7 @@ main(int argc, char *argv[])
 {
        acl_t acl;
        acl_type_t acl_type;
+       acl_entry_t unused_entry;
        char filename[PATH_MAX];
        int local_error, carried_error, ch, i, entry_number, ret;
        int h_flag;
@@ -296,6 +297,20 @@ main(int argc, char *argv[])
                        }
                }
 
+               /*
+                * Don't try to set an empty default ACL; it will always fail.
+                * Use acl_delete_def_file(3) instead.
+                */
+               if (acl_type == ACL_TYPE_DEFAULT &&
+                   acl_get_entry(acl, ACL_FIRST_ENTRY, &unused_entry) == 0) {
+                       if (acl_delete_def_file(file->filename) == -1) {
+                               warn("%s: acl_delete_def_file() failed",
+                                   file->filename);
+                               carried_error++;
+                       }
+                       continue;
+               }
+
                /* don't bother setting the ACL if something is broken */
                if (local_error) {
                        carried_error++;
_______________________________________________
svn-src-stable-9@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-stable-9
To unsubscribe, send any mail to "svn-src-stable-9-unsubscr...@freebsd.org"

Reply via email to