]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Fix build failure without XATTR support on Mac.
authorMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 3 Dec 2012 23:26:37 +0000 (08:26 +0900)
committerMichihiro NAKAJIMA <ggcueroad@gmail.com>
Mon, 3 Dec 2012 23:26:37 +0000 (08:26 +0900)
libarchive/archive_write_disk_posix.c
libarchive/test/test_write_disk_appledouble.c
libarchive/test/test_write_disk_hfs_compression.c
libarchive/test/test_write_disk_mac_metadata.c
libarchive/test/test_write_disk_no_hfs_compression.c

index f1ee448af99a3dc3289cc2ae9c9ce98b15c3e842..8fa39cb74941e90ee8c8948b48fb421a302ad4f4 100644 (file)
@@ -839,7 +839,7 @@ write_data_block(struct archive_write_disk *a, const char *buff, size_t size)
        return (start_size - size);
 }
 
-#if defined(__APPLE__) && defined(UF_COMPRESSED)
+#if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)
 
 /*
  * Set UF_COMPRESSED file flag.
@@ -3332,6 +3332,7 @@ fixup_appledouble(struct archive_write_disk *a, const char *pathname)
  * apply it to the target file.
  */
 
+#if defined(HAVE_SYS_XATTR_H)
 static int
 copy_xattrs(struct archive_write_disk *a, int tmpfd, int dffd)
 {
@@ -3399,6 +3400,7 @@ exit_xattr:
        free(xattr_val);
        return (ret);
 }
+#endif
 
 static int
 copy_acls(struct archive_write_disk *a, int tmpfd, int dffd)
@@ -3486,8 +3488,10 @@ copy_metadata(struct archive_write_disk *a, const char *metadata,
                        return (ARCHIVE_WARN);
                }
 
+#if defined(HAVE_SYS_XATTR_H)
                ret = copy_xattrs(a, tmpfd, dffd);
                if (ret == ARCHIVE_OK)
+#endif
                        ret = copy_acls(a, tmpfd, dffd);
                close(tmpfd);
                close(dffd);
@@ -3536,10 +3540,12 @@ set_mac_metadata(struct archive_write_disk *a, const char *pathname,
        } else {
                int compressed;
 
+#if defined(UF_COMPRESSED)
                if ((a->todo & TODO_HFS_COMPRESSION) != 0 &&
                    (ret = lazy_stat(a)) == ARCHIVE_OK)
                        compressed = a->st.st_flags & UF_COMPRESSED;
                else
+#endif
                        compressed = 0;
                ret = copy_metadata(a, tmp.s, pathname, compressed);
        }
@@ -3606,7 +3612,11 @@ fixup_appledouble(struct archive_write_disk *a, const char *pathname)
                goto skip_appledouble;
 
        ret = copy_metadata(a, pathname, datafork.s,
+#if defined(UF_COMPRESSED)
            st.st_flags & UF_COMPRESSED);
+#else
+           0);
+#endif
        if (ret == ARCHIVE_OK) {
                unlink(pathname);
                ret = ARCHIVE_EOF;
index ed0b1e7d09c7acc208830d3f6a8d9e91e7953f69..e9ec6cb4932d7bbde507714b77510a71c2c3afaa 100644 (file)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/xattr.h>
 #endif
 
-#if defined(__APPLE__) && defined(UF_COMPRESSED)
+#if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)
 static int
 has_xattr(const char *filename, const char *xattrname)
 {
@@ -75,7 +75,7 @@ has_xattr(const char *filename, const char *xattrname)
  */
 DEFINE_TEST(test_write_disk_appledouble)
 {
-#if !defined(__APPLE__) || !defined(UF_COMPRESSED)
+#if !defined(__APPLE__) || !defined(UF_COMPRESSED) || !defined(HAVE_SYS_XATTR_H)
        skipping("MacOS-specific AppleDouble test");
 #else
        const char *refname = "test_write_disk_appledouble.cpio.gz";
index 2874307f1f9f1fd9e4c4ad0b9ca17deb819bbafe..dbb8a6fbce0a468fdb3eb475b9e61e99271afab2 100644 (file)
@@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/xattr.h>
 #endif
 
-#if defined(__APPLE__) && defined(UF_COMPRESSED)
+#if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)
 static int
 has_xattr(const char *filename, const char *xattrname)
 {
@@ -87,7 +87,7 @@ get_rsrc_footer(const char *filename, char *buff, size_t s)
  */
 DEFINE_TEST(test_write_disk_hfs_compression)
 {
-#if !defined(__APPLE__) || !defined(UF_COMPRESSED)
+#if !defined(__APPLE__) || !defined(UF_COMPRESSED) || !defined(HAVE_SYS_XATTR_H)
        skipping("MacOS-specific HFS+ Compression test");
 #else
        const char *refname = "test_write_disk_hfs_compression.tgz";
index a59f6b0296670d196eed31e5787984cf8fb23901..aef6152ee2fbc542e9832be6ea466e8e8907d616 100644 (file)
@@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/xattr.h>
 #endif
 
-#if defined(__APPLE__) && defined(UF_COMPRESSED)
+#if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)
 static int
 has_xattr(const char *filename, const char *xattrname)
 {
@@ -75,7 +75,7 @@ has_xattr(const char *filename, const char *xattrname)
  */
 DEFINE_TEST(test_write_disk_mac_metadata)
 {
-#if !defined(__APPLE__) || !defined(UF_COMPRESSED)
+#if !defined(__APPLE__) || !defined(UF_COMPRESSED) || !defined(HAVE_SYS_XATTR_H)
        skipping("MacOS-specific Mac Metadata test");
 #else
        const char *refname = "test_write_disk_mac_metadata.tar.gz";
index 8ed8a7b4efda8e76478ce738016ec5c097298e8b..9c6d2c21a8657860e731a66b61566d791845ef1a 100644 (file)
@@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$");
 #include <sys/xattr.h>
 #endif
 
-#if defined(__APPLE__) && defined(UF_COMPRESSED)
+#if defined(__APPLE__) && defined(UF_COMPRESSED) && defined(HAVE_SYS_XATTR_H)
 static int
 has_xattr(const char *filename, const char *xattrname)
 {
@@ -71,7 +71,7 @@ has_xattr(const char *filename, const char *xattrname)
  */
 DEFINE_TEST(test_write_disk_no_hfs_compression)
 {
-#if !defined(__APPLE__) || !defined(UF_COMPRESSED)
+#if !defined(__APPLE__) || !defined(UF_COMPRESSED) || !defined(HAVE_SYS_XATTR_H)
        skipping("MacOS-specific HFS+ Compression test");
 #else
        const char *refname = "test_write_disk_no_hfs_compression.tgz";