summaryrefslogtreecommitdiffstats
path: root/bin/setfacl
diff options
context:
space:
mode:
authortrasz <trasz@FreeBSD.org>2012-09-04 11:43:00 +0000
committertrasz <trasz@FreeBSD.org>2012-09-04 11:43:00 +0000
commit510edf439e17d9c0bc3d03435da40fb7e2e35a84 (patch)
tree1f10f447f8cd5b3ab3da79641670dcb933d9f9ad /bin/setfacl
parentb0a87922fb5b1c9cd4de7fa4cccf8b0d29ccc5fe (diff)
downloadFreeBSD-src-510edf439e17d9c0bc3d03435da40fb7e2e35a84.zip
FreeBSD-src-510edf439e17d9c0bc3d03435da40fb7e2e35a84.tar.gz
Make setfacl(1) behave properly in situations like "setfacl -kd".
MFC after: 1 month
Diffstat (limited to 'bin/setfacl')
-rw-r--r--bin/setfacl/setfacl.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/bin/setfacl/setfacl.c b/bin/setfacl/setfacl.c
index 7534794..41a37f2 100644
--- a/bin/setfacl/setfacl.c
+++ b/bin/setfacl/setfacl.c
@@ -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++;
OpenPOWER on IntegriCloud