]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
When writing ACLs use acl_set_fd_np() if available before acl_set_fd()
authorMartin Matuska <martin@matuska.org>
Fri, 6 Jan 2017 02:50:43 +0000 (03:50 +0100)
committerMartin Matuska <martin@matuska.org>
Fri, 6 Jan 2017 02:50:43 +0000 (03:50 +0100)
libarchive/archive_write_disk_acl.c

index ea37c859d3c0e490901a072153c341739fb471ff..83b5db840703debe8342399421f145b967606cd4 100644 (file)
@@ -295,13 +295,13 @@ set_acl(struct archive *a, int fd, const char *name,
        }
 
        /* Try restoring the ACL through 'fd' if we can. */
-#if HAVE_ACL_SET_FD
-       if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0)
+#if HAVE_ACL_SET_FD_NP
+       if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0)
                ret = ARCHIVE_OK;
        else
 #else
-#if HAVE_ACL_SET_FD_NP
-       if (fd >= 0 && acl_set_fd_np(fd, acl, acl_type) == 0)
+#if HAVE_ACL_SET_FD
+       if (fd >= 0 && acl_type == ACL_TYPE_ACCESS && acl_set_fd(fd, acl) == 0)
                ret = ARCHIVE_OK;
        else
 #endif