Blame SOURCES/0041-tmpfiles-quietly-ignore-ACLs-on-unsupported-filesyst.patch

17b0f1
From 6ad61c838992d17f5faa94faa8f17967083a4226 Mon Sep 17 00:00:00 2001
17b0f1
From: Hans-Peter Deifel <hpd@hpdeifel.de>
17b0f1
Date: Tue, 3 Mar 2015 00:35:08 +0100
17b0f1
Subject: [PATCH] tmpfiles: quietly ignore ACLs on unsupported filesystems
17b0f1
17b0f1
A warning is printed if ACLs cannot be retrieved for any reason other
17b0f1
than -ENOSYS. For -ENOSYS, debug log is printed.
17b0f1
17b0f1
(cherry picked from commit d873e8778c92014c02a9122852758b436fa95c0e)
17b0f1
---
17b0f1
 src/tmpfiles/tmpfiles.c | 36 ++++++++++++++++++++----------------
17b0f1
 1 file changed, 20 insertions(+), 16 deletions(-)
17b0f1
17b0f1
diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c
17b0f1
index 88ba7e46a2..187997e1f4 100644
17b0f1
--- a/src/tmpfiles/tmpfiles.c
17b0f1
+++ b/src/tmpfiles/tmpfiles.c
17b0f1
@@ -704,6 +704,9 @@ static int path_set_acl(const char *path, acl_type_t type, acl_t acl, bool modif
17b0f1
         int r;
17b0f1
         _cleanup_(acl_free_charpp) char *t = NULL;
17b0f1
 
17b0f1
+        /* Returns 0 for success, positive error if already warned,
17b0f1
+         * negative error otherwise. */
17b0f1
+
17b0f1
         if (modify) {
17b0f1
                 r = acls_for_file(path, type, acl, &dup;;
17b0f1
                 if (r < 0)
17b0f1
@@ -731,35 +734,36 @@ static int path_set_acl(const char *path, acl_type_t type, acl_t acl, bool modif
17b0f1
 
17b0f1
         r = acl_set_file(path, type, dup);
17b0f1
         if (r < 0)
17b0f1
-                return log_error_errno(-errno,
17b0f1
-                                       "Setting %s ACL \"%s\" on %s failed: %m",
17b0f1
-                                       type == ACL_TYPE_ACCESS ? "access" : "default",
17b0f1
-                                       strna(t), path);
17b0f1
+                return -log_error_errno(errno,
17b0f1
+                                        "Setting %s ACL \"%s\" on %s failed: %m",
17b0f1
+                                        type == ACL_TYPE_ACCESS ? "access" : "default",
17b0f1
+                                        strna(t), path);
17b0f1
+
17b0f1
         return 0;
17b0f1
 }
17b0f1
 #endif
17b0f1
 
17b0f1
 static int path_set_acls(Item *item, const char *path) {
17b0f1
+        int r = 0;
17b0f1
 #ifdef HAVE_ACL
17b0f1
-        int r;
17b0f1
-
17b0f1
         assert(item);
17b0f1
         assert(path);
17b0f1
 
17b0f1
-        if (item->acl_access) {
17b0f1
+        if (item->acl_access)
17b0f1
                 r = path_set_acl(path, ACL_TYPE_ACCESS, item->acl_access, item->force);
17b0f1
-                if (r < 0)
17b0f1
-                        return r;
17b0f1
-        }
17b0f1
 
17b0f1
-        if (item->acl_default) {
17b0f1
+        if (r == 0 && item->acl_default)
17b0f1
                 r = path_set_acl(path, ACL_TYPE_DEFAULT, item->acl_default, item->force);
17b0f1
-                if (r < 0)
17b0f1
-                        return r;
17b0f1
-        }
17b0f1
-#endif
17b0f1
 
17b0f1
-        return 0;
17b0f1
+        if (r > 0)
17b0f1
+                return -r; /* already warned */
17b0f1
+        else if (r == -ENOTSUP) {
17b0f1
+                log_debug_errno(r, "ACLs not supported by file system at %s", path);
17b0f1
+                return 0;
17b0f1
+        } else if (r < 0)
17b0f1
+                log_error_errno(r, "ACL operation on \"%s\" failed: %m", path);
17b0f1
+#endif
17b0f1
+        return r;
17b0f1
 }
17b0f1
 
17b0f1
 static int write_one_file(Item *i, const char *path) {