[Midnightbsd-cvs] src [8148] trunk/bin/setfacl/setfacl.c: make setfacl -kd work

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Fri Sep 16 18:17:28 EDT 2016


Revision: 8148
          http://svnweb.midnightbsd.org/src/?rev=8148
Author:   laffer1
Date:     2016-09-16 18:17:27 -0400 (Fri, 16 Sep 2016)
Log Message:
-----------
make setfacl -kd work

Modified Paths:
--------------
    trunk/bin/setfacl/setfacl.c

Modified: trunk/bin/setfacl/setfacl.c
===================================================================
--- trunk/bin/setfacl/setfacl.c	2016-09-16 22:16:33 UTC (rev 8147)
+++ trunk/bin/setfacl/setfacl.c	2016-09-16 22:17:27 UTC (rev 8148)
@@ -1,4 +1,4 @@
-/* $MidnightBSD: src/bin/setfacl/setfacl.c,v 1.3 2007/07/26 20:13:01 laffer1 Exp $ */
+/* $MidnightBSD$ */
 /*-
  * Copyright (c) 2001 Chris D. Faulhaber
  * All rights reserved.
@@ -74,6 +74,7 @@
 {
 	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;
@@ -297,6 +298,20 @@
 			}
 		}
 
+		/*
+		 * 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++;



More information about the Midnightbsd-cvs mailing list