]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
When trying to write ACLs do not warn if filesystem has no ACL support
authorMartin Matuska <martin@matuska.org>
Sun, 8 Jan 2017 21:24:40 +0000 (22:24 +0100)
committerMartin Matuska <martin@matuska.org>
Sun, 8 Jan 2017 21:48:34 +0000 (22:48 +0100)
libarchive/archive_write_disk_acl.c

index 83b5db840703debe8342399421f145b967606cd4..e49816b15cb1d2e8b64deb09a4f8aa5e7d44c82c 100644 (file)
@@ -298,26 +298,35 @@ set_acl(struct archive *a, int fd, const char *name,
 #if HAVE_ACL_SET_FD_NP
        if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0)
                ret = ARCHIVE_OK;
-       else
+       else if (fd >= 0 && errno == EOPNOTSUPP) {
+               /* Filesystem doesn't support ACLs */
+               ret = ARCHIVE_OK;
+       } else
 #else
 #if HAVE_ACL_SET_FD
        if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0)
                ret = ARCHIVE_OK;
-       else
+       else if (fd >= 0 && errno == EOPNOTSUPP) {
+               /* Filesystem doesn't support ACLs */
+               ret = ARCHIVE_OK;
+       } else
 #endif
 #endif
 #if HAVE_ACL_SET_LINK_NP
-         if (acl_set_link_np(name, acl_type, acl) != 0) {
-               archive_set_error(a, errno, "Failed to set %s acl", tname);
-               ret = ARCHIVE_WARN;
-         }
+       if (acl_set_link_np(name, acl_type, acl) != 0) {
 #else
        /* TODO: Skip this if 'name' is a symlink. */
        if (acl_set_file(name, acl_type, acl) != 0) {
-               archive_set_error(a, errno, "Failed to set %s acl", tname);
-               ret = ARCHIVE_WARN;
-       }
 #endif
+               if (errno == EOPNOTSUPP) {
+                       /* Filesystem doesn't support ACLs */
+                       ret = ARCHIVE_OK;
+               } else {
+                       archive_set_error(a, errno, "Failed to set %s acl",
+                           tname);
+                       ret = ARCHIVE_WARN;
+               }
+         }
 exit_free:
        acl_free(acl);
        return (ret);