pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/archivers/libarchive/files/libarchive Merge a15c7f7b49...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/4ff12a8957d9
branches:  trunk
changeset: 359484:4ff12a8957d9
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Mar 12 06:48:36 2017 +0000

description:
Merge a15c7f7b496ba4cefbcaf6f8ac637db4f3009a58:

 Solaris: use aclp instead of acl to not shadow global acl()

diffstat:

 archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c |  115 +++++----
 1 files changed, 66 insertions(+), 49 deletions(-)

diffs (211 lines):

diff -r bd9e78c19968 -r 4ff12a8957d9 archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c
--- a/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c Sun Mar 12 06:45:16 2017 +0000
+++ b/archivers/libarchive/files/libarchive/archive_read_disk_entry_from_file.c Sun Mar 12 06:48:36 2017 +0000
@@ -496,7 +496,7 @@
 static int translate_acl(struct archive_read_disk *a,
     struct archive_entry *entry,
 #if HAVE_SUN_ACL
-    void *acl,
+    void *aclp,
     int aclcnt,
 #else
     acl_t acl,
@@ -509,7 +509,7 @@
 {
        const char      *accpath;
 #if HAVE_SUN_ACL
-       void            *acl;
+       void            *aclp;
        int             aclcnt;
 #else
        acl_t           acl;
@@ -547,13 +547,17 @@
 
        archive_entry_acl_clear(entry);
 
+#if HAVE_SUN_ACL
+       aclp = NULL;
+#else
        acl = NULL;
+#endif
 
 #if HAVE_NFS4_ACL
        /* Try NFSv4 ACL first. */
        if (*fd >= 0)
 #if HAVE_SUN_ACL
-               acl = sunacl_get(ACE_GETACL, &aclcnt, *fd, NULL);
+               aclp = sunacl_get(ACE_GETACL, &aclcnt, *fd, NULL);
 #elif HAVE_ACL_GET_FD_NP
                acl = acl_get_fd_np(*fd, ARCHIVE_PLATFORM_ACL_TYPE_NFS4);
 #else
@@ -567,52 +571,59 @@
            && (archive_entry_filetype(entry) == AE_IFLNK))
                /* We can't get the ACL of a symlink, so we assume it can't
                   have one. */
+#if HAVE_SUN_ACL
+               aclp = NULL;
+#else
                acl = NULL;
 #endif
+#endif /* !HAVE_ACL_GET_LINK_NP */
        else
 #if HAVE_SUN_ACL
                /* Solaris reads both POSIX.1e and NFSv4 ACLs here */
-               acl = sunacl_get(ACE_GETACL, &aclcnt, 0, accpath);
+               aclp = sunacl_get(ACE_GETACL, &aclcnt, 0, accpath);
 #else
                acl = acl_get_file(accpath, ARCHIVE_PLATFORM_ACL_TYPE_NFS4);
 #endif
 
 
-#if HAVE_ACL_IS_TRIVIAL_NP || HAVE_SUN_ACL
        /* Ignore "trivial" ACLs that just mirror the file mode. */
-       if (acl != NULL) {
 #if HAVE_SUN_ACL
-               if (sun_acl_is_trivial(acl, aclcnt, archive_entry_mode(entry),
-                   1, S_ISDIR(archive_entry_mode(entry)), &r) == 0 && r == 1)
+       if (aclp != NULL && sun_acl_is_trivial(aclp, aclcnt,
+           archive_entry_mode(entry), 1, S_ISDIR(archive_entry_mode(entry)),
+           &r) == 0 && r == 1) {
+               free(aclp);
+               aclp = NULL;
+               return (ARCHIVE_OK);
+       }
 #elif HAVE_ACL_IS_TRIVIAL_NP
-               if (acl_is_trivial_np(acl, &r) == 0 && r == 1)
+       if (acl != NULL && acl_is_trivial_np(acl, &r) == 0 && r == 1) {
+               acl_free(acl);
+               acl = NULL;
+               return (ARCHIVE_OK);
+       }
 #endif
-               {
+
 #if HAVE_SUN_ACL
-                       free(acl);
+       if (aclp != NULL)
 #else
-                       acl_free(acl);
+       if (acl != NULL)
 #endif
-                       acl = NULL;
-                       /*
-                        * Simultaneous NFSv4 and POSIX.1e ACLs for the same
-                        * entry are not allowed, so we should return here
-                        */
-                       return (ARCHIVE_OK);
-               }
-       }
-#endif /* HAVE_ACL_IS_TRIVIAL_NP || HAVE_SUN_ACL */
-       if (acl != NULL) {
-               r = translate_acl(a, entry, acl,
+       {
+               r = translate_acl(a, entry,
 #if HAVE_SUN_ACL
-                   aclcnt,
+                   aclp, aclcnt,
+#else
+                   acl,
 #endif
                    ARCHIVE_ENTRY_ACL_TYPE_NFS4);
 #if HAVE_SUN_ACL
-               free(acl);
+               free(aclp);
+               aclp = NULL;
 #else
                acl_free(acl);
+               acl = NULL;
 #endif
+
                if (r != ARCHIVE_OK) {
                        archive_set_error(&a->archive, errno,
                            "Couldn't translate NFSv4 ACLs");
@@ -638,7 +649,7 @@
        /* Retrieve access ACL from file. */
        if (*fd >= 0)
 #if HAVE_SUN_ACL
-               acl = sunacl_get(GETACL, &aclcnt, *fd, NULL);
+               aclp = sunacl_get(GETACL, &aclcnt, *fd, NULL);
 #else
                acl = acl_get_fd(*fd);
 #endif
@@ -650,50 +661,56 @@
            && (archive_entry_filetype(entry) == AE_IFLNK))
                /* We can't get the ACL of a symlink, so we assume it can't
                   have one. */
+#if HAVE_SUN_ACL
+               aclp = NULL;
+#else
                acl = NULL;
 #endif
+#endif /* !HAVE_ACL_GET_LINK_NP */
        else
 #if HAVE_SUN_ACL
-               acl = sunacl_get(GETACL, &aclcnt, 0, accpath);
+               aclp = sunacl_get(GETACL, &aclcnt, 0, accpath);
 #else
                acl = acl_get_file(accpath, ACL_TYPE_ACCESS);
 #endif
 
 
-#if HAVE_ACL_IS_TRIVIAL_NP || HAVE_SUN_ACL
        /* Ignore "trivial" ACLs that just mirror the file mode. */
-       if (acl != NULL) {
 #if HAVE_SUN_ACL
-               if (sun_acl_is_trivial(acl, aclcnt, archive_entry_mode(entry),
-                   0, S_ISDIR(archive_entry_mode(entry)), &r) == 0 && r == 1)
-#else
-               if (acl_is_trivial_np(acl, &r) == 0)
-#endif
-               {
-                       if (r) {
-#if HAVE_SUN_ACL
-                               free(acl);
-#else
-                               acl_free(acl);
-#endif
-                               acl = NULL;
-                       }
-               }
+       if (aclp != NULL && sun_acl_is_trivial(aclp, aclcnt,
+           archive_entry_mode(entry), 0, S_ISDIR(archive_entry_mode(entry)),
+           &r) == 0 && r == 1) {
+               free(aclp);
+               aclp = NULL;
+       }
+#elif HAVE_ACL_IS_TRIVIAL_NP
+       if (acl != NULL && acl_is_trivial_np(acl, &r) == 0 && r == 1) {
+               acl_free(acl);
+               acl = NULL;
        }
 #endif
 
-       if (acl != NULL) {
-               r = translate_acl(a, entry, acl,
 #if HAVE_SUN_ACL
-                   aclcnt,
+       if (aclp != NULL)
+#else
+       if (acl != NULL)
+#endif
+       {
+               r = translate_acl(a, entry,
+#if HAVE_SUN_ACL
+                   aclp, aclcnt,
+#else
+                   acl,
 #endif
                    ARCHIVE_ENTRY_ACL_TYPE_ACCESS);
 #if HAVE_SUN_ACL
-               free(acl);
+               free(aclp);
+               aclp = NULL;
 #else
                acl_free(acl);
+               acl = NULL;
 #endif
-               acl = NULL;
+
                if (r != ARCHIVE_OK) {
                        archive_set_error(&a->archive, errno,
                            "Couldn't translate access ACLs");



Home | Main Index | Thread Index | Old Index