Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 4 Sep 2012 11:43:00 +0000 (UTC)
From:      Edward Tomasz Napierala <trasz@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r240083 - head/bin/setfacl
Message-ID:  <201209041143.q84Bh0MV048261@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: trasz
Date: Tue Sep  4 11:43:00 2012
New Revision: 240083
URL: http://svn.freebsd.org/changeset/base/240083

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

Modified:
  head/bin/setfacl/setfacl.c

Modified: head/bin/setfacl/setfacl.c
==============================================================================
--- head/bin/setfacl/setfacl.c	Tue Sep  4 10:56:30 2012	(r240082)
+++ head/bin/setfacl/setfacl.c	Tue Sep  4 11:43:00 2012	(r240083)
@@ -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++;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201209041143.q84Bh0MV048261>