From: Michihiro NAKAJIMA Date: Mon, 3 Dec 2012 23:26:37 +0000 (+0900) Subject: Fix build failure without XATTR support on Mac. X-Git-Tag: v3.1.0~20 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=63f4eb7d3cd058b2dfa6fffa0e7a0e0fdcc8cc21;p=thirdparty%2Flibarchive.git Fix build failure without XATTR support on Mac. --- diff --git a/libarchive/archive_write_disk_posix.c b/libarchive/archive_write_disk_posix.c index f1ee448af..8fa39cb74 100644 --- a/libarchive/archive_write_disk_posix.c +++ b/libarchive/archive_write_disk_posix.c @@ -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; diff --git a/libarchive/test/test_write_disk_appledouble.c b/libarchive/test/test_write_disk_appledouble.c index ed0b1e7d0..e9ec6cb49 100644 --- a/libarchive/test/test_write_disk_appledouble.c +++ b/libarchive/test/test_write_disk_appledouble.c @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #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"; diff --git a/libarchive/test/test_write_disk_hfs_compression.c b/libarchive/test/test_write_disk_hfs_compression.c index 2874307f1..dbb8a6fbc 100644 --- a/libarchive/test/test_write_disk_hfs_compression.c +++ b/libarchive/test/test_write_disk_hfs_compression.c @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); #include #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"; diff --git a/libarchive/test/test_write_disk_mac_metadata.c b/libarchive/test/test_write_disk_mac_metadata.c index a59f6b029..aef6152ee 100644 --- a/libarchive/test/test_write_disk_mac_metadata.c +++ b/libarchive/test/test_write_disk_mac_metadata.c @@ -33,7 +33,7 @@ __FBSDID("$FreeBSD$"); #include #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"; diff --git a/libarchive/test/test_write_disk_no_hfs_compression.c b/libarchive/test/test_write_disk_no_hfs_compression.c index 8ed8a7b4e..9c6d2c21a 100644 --- a/libarchive/test/test_write_disk_no_hfs_compression.c +++ b/libarchive/test/test_write_disk_no_hfs_compression.c @@ -30,7 +30,7 @@ __FBSDID("$FreeBSD$"); #include #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";