Merge branch 'upstream-LibArchive' into update-libarchive

* upstream-LibArchive:
  LibArchive 2017-02-25 (d6b1bb9f)
This commit is contained in:
Brad King
2017-02-27 08:51:36 -05:00
14 changed files with 228 additions and 124 deletions
+11 -4
View File
@@ -17,13 +17,13 @@ SET(CMAKE_MACOSX_RPATH ON)
# #
FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version) FILE(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/build/version _version)
STRING(REGEX REPLACE STRING(REGEX REPLACE
"^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]?$" "\\1" _major ${_version}) "^([0-9])[0-9][0-9][0-9][0-9][0-9][0-9][a-z]*$" "\\1" _major ${_version})
STRING(REGEX REPLACE STRING(REGEX REPLACE
"^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]?$" "\\1" _minor ${_version}) "^[0-9]([0-9][0-9][0-9])[0-9][0-9][0-9][a-z]*$" "\\1" _minor ${_version})
STRING(REGEX REPLACE STRING(REGEX REPLACE
"^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]?$" "\\1" _revision ${_version}) "^[0-9][0-9][0-9][0-9]([0-9][0-9][0-9])[a-z]*$" "\\1" _revision ${_version})
STRING(REGEX REPLACE STRING(REGEX REPLACE
"^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]?)$" "\\1" _quality ${_version}) "^[0-9][0-9][0-9][0-9][0-9][0-9][0-9]([a-z]*)$" "\\1" _quality ${_version})
SET(_version_number ${_major}${_minor}${_revision}) SET(_version_number ${_major}${_minor}${_revision})
STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor}) STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_minor ${_minor})
STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision}) STRING(REGEX REPLACE "[0]*([^0]*[0-9])$" "\\1" _trimmed_revision ${_revision})
@@ -295,6 +295,8 @@ ENDIF()
IF(LIBLZMA_FOUND) IF(LIBLZMA_FOUND)
SET(HAVE_LIBLZMA 1) SET(HAVE_LIBLZMA 1)
SET(HAVE_LZMA_H 1) SET(HAVE_LZMA_H 1)
SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR})
SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES})
INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS})
LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES})
IF(CMAKE_USE_SYSTEM_LIBLZMA) IF(CMAKE_USE_SYSTEM_LIBLZMA)
@@ -415,6 +417,11 @@ LA_CHECK_INCLUDE_FILE("limits.h" HAVE_LIMITS_H)
LA_CHECK_INCLUDE_FILE("linux/types.h" HAVE_LINUX_TYPES_H) LA_CHECK_INCLUDE_FILE("linux/types.h" HAVE_LINUX_TYPES_H)
LA_CHECK_INCLUDE_FILE("linux/fiemap.h" HAVE_LINUX_FIEMAP_H) LA_CHECK_INCLUDE_FILE("linux/fiemap.h" HAVE_LINUX_FIEMAP_H)
LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H) LA_CHECK_INCLUDE_FILE("linux/fs.h" HAVE_LINUX_FS_H)
CHECK_C_SOURCE_COMPILES("#include <sys/ioctl.h>
#include <linux/fs.h>
int main(void) { return FS_IOC_GETFLAGS; }" HAVE_WORKING_FS_IOC_GETFLAGS)
LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H) LA_CHECK_INCLUDE_FILE("linux/magic.h" HAVE_LINUX_MAGIC_H)
LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H) LA_CHECK_INCLUDE_FILE("locale.h" HAVE_LOCALE_H)
LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H) LA_CHECK_INCLUDE_FILE("memory.h" HAVE_MEMORY_H)
@@ -1105,6 +1105,9 @@ typedef uint64_t uintmax_t;
/* Define to 1 if you have a working EXT2_IOC_GETFLAGS */ /* Define to 1 if you have a working EXT2_IOC_GETFLAGS */
#cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1 #cmakedefine HAVE_WORKING_EXT2_IOC_GETFLAGS 1
/* Define to 1 if you have a working FS_IOC_GETFLAGS */
#cmakedefine HAVE_WORKING_FS_IOC_GETFLAGS 1
/* Define to 1 if you have the <zlib.h> header file. */ /* Define to 1 if you have the <zlib.h> header file. */
#cmakedefine HAVE_ZLIB_H 1 #cmakedefine HAVE_ZLIB_H 1
+1 -1
View File
@@ -1 +1 @@
3003000 3003001
+6 -2
View File
@@ -36,7 +36,7 @@
* assert that ARCHIVE_VERSION_NUMBER >= 2012108. * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
*/ */
/* Note: Compiler will complain if this does not match archive_entry.h! */ /* Note: Compiler will complain if this does not match archive_entry.h! */
#define ARCHIVE_VERSION_NUMBER 3003000 #define ARCHIVE_VERSION_NUMBER 3003001
#include <sys/stat.h> #include <sys/stat.h>
#include <stddef.h> /* for wchar_t */ #include <stddef.h> /* for wchar_t */
@@ -152,7 +152,7 @@ __LA_DECL int archive_version_number(void);
/* /*
* Textual name/version of the library, useful for version displays. * Textual name/version of the library, useful for version displays.
*/ */
#define ARCHIVE_VERSION_ONLY_STRING "3.3.0" #define ARCHIVE_VERSION_ONLY_STRING "3.3.1"
#define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
__LA_DECL const char * archive_version_string(void); __LA_DECL const char * archive_version_string(void);
@@ -998,6 +998,10 @@ __LA_DECL int archive_read_disk_set_atime_restored(struct archive *);
#define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008) #define ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS (0x0008)
/* Default: Xattrs are read from disk. */ /* Default: Xattrs are read from disk. */
#define ARCHIVE_READDISK_NO_XATTR (0x0010) #define ARCHIVE_READDISK_NO_XATTR (0x0010)
/* Default: ACLs are read from disk. */
#define ARCHIVE_READDISK_NO_ACL (0x0020)
/* Default: File flags are read from disk. */
#define ARCHIVE_READDISK_NO_FFLAGS (0x0040)
__LA_DECL int archive_read_disk_set_behavior(struct archive *, __LA_DECL int archive_read_disk_set_behavior(struct archive *,
int flags); int flags);
@@ -143,6 +143,7 @@
defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\ defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\ defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\
defined(ARCHIVE_CRYPTO_SHA512_WIN) defined(ARCHIVE_CRYPTO_SHA512_WIN)
#include <windows.h>
#include <wincrypt.h> #include <wincrypt.h>
typedef struct { typedef struct {
int valid; int valid;
@@ -1649,7 +1649,10 @@ static struct flag {
{ "nosappnd", L"nosappnd", SF_APPEND, 0 }, { "nosappnd", L"nosappnd", SF_APPEND, 0 },
{ "nosappend", L"nosappend", SF_APPEND, 0 }, { "nosappend", L"nosappend", SF_APPEND, 0 },
#endif #endif
#ifdef EXT2_APPEND_FL /* 'a' */ #if defined(FS_APPEND_FL) /* 'a' */
{ "nosappnd", L"nosappnd", FS_APPEND_FL, 0 },
{ "nosappend", L"nosappend", FS_APPEND_FL, 0 },
#elif defined(EXT2_APPEND_FL) /* 'a' */
{ "nosappnd", L"nosappnd", EXT2_APPEND_FL, 0 }, { "nosappnd", L"nosappnd", EXT2_APPEND_FL, 0 },
{ "nosappend", L"nosappend", EXT2_APPEND_FL, 0 }, { "nosappend", L"nosappend", EXT2_APPEND_FL, 0 },
#endif #endif
@@ -1662,7 +1665,11 @@ static struct flag {
{ "noschange", L"noschange", SF_IMMUTABLE, 0 }, { "noschange", L"noschange", SF_IMMUTABLE, 0 },
{ "nosimmutable", L"nosimmutable", SF_IMMUTABLE, 0 }, { "nosimmutable", L"nosimmutable", SF_IMMUTABLE, 0 },
#endif #endif
#ifdef EXT2_IMMUTABLE_FL /* 'i' */ #if defined(FS_IMMUTABLE_FL) /* 'i' */
{ "noschg", L"noschg", FS_IMMUTABLE_FL, 0 },
{ "noschange", L"noschange", FS_IMMUTABLE_FL, 0 },
{ "nosimmutable", L"nosimmutable", FS_IMMUTABLE_FL, 0 },
#elif defined(EXT2_IMMUTABLE_FL) /* 'i' */
{ "noschg", L"noschg", EXT2_IMMUTABLE_FL, 0 }, { "noschg", L"noschg", EXT2_IMMUTABLE_FL, 0 },
{ "noschange", L"noschange", EXT2_IMMUTABLE_FL, 0 }, { "noschange", L"noschange", EXT2_IMMUTABLE_FL, 0 },
{ "nosimmutable", L"nosimmutable", EXT2_IMMUTABLE_FL, 0 }, { "nosimmutable", L"nosimmutable", EXT2_IMMUTABLE_FL, 0 },
@@ -1686,7 +1693,9 @@ static struct flag {
#ifdef UF_NODUMP #ifdef UF_NODUMP
{ "nodump", L"nodump", 0, UF_NODUMP}, { "nodump", L"nodump", 0, UF_NODUMP},
#endif #endif
#ifdef EXT2_NODUMP_FL /* 'd' */ #if defined(FS_NODUMP_FL) /* 'd' */
{ "nodump", L"nodump", 0, FS_NODUMP_FL},
#elif defined(EXT2_NODUMP_FL) /* 'd' */
{ "nodump", L"nodump", 0, EXT2_NODUMP_FL}, { "nodump", L"nodump", 0, EXT2_NODUMP_FL},
#endif #endif
#ifdef UF_OPAQUE #ifdef UF_OPAQUE
@@ -1699,65 +1708,124 @@ static struct flag {
#ifdef UF_COMPRESSED #ifdef UF_COMPRESSED
{ "nocompressed",L"nocompressed", UF_COMPRESSED, 0 }, { "nocompressed",L"nocompressed", UF_COMPRESSED, 0 },
#endif #endif
#ifdef EXT2_UNRM_FL #if defined(FS_UNRM_FL)
{ "nouunlink", L"nouunlink", FS_UNRM_FL, 0},
#elif defined(EXT2_UNRM_FL)
{ "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0}, { "nouunlink", L"nouunlink", EXT2_UNRM_FL, 0},
#endif #endif
#ifdef EXT2_BTREE_FL #if defined(FS_BTREE_FL)
{ "nobtree", L"nobtree", FS_BTREE_FL, 0 },
#elif defined(EXT2_BTREE_FL)
{ "nobtree", L"nobtree", EXT2_BTREE_FL, 0 }, { "nobtree", L"nobtree", EXT2_BTREE_FL, 0 },
#endif #endif
#ifdef EXT2_ECOMPR_FL #if defined(FS_ECOMPR_FL)
{ "nocomperr", L"nocomperr", FS_ECOMPR_FL, 0 },
#elif defined(EXT2_ECOMPR_FL)
{ "nocomperr", L"nocomperr", EXT2_ECOMPR_FL, 0 }, { "nocomperr", L"nocomperr", EXT2_ECOMPR_FL, 0 },
#endif #endif
#ifdef EXT2_COMPR_FL /* 'c' */ #if defined(FS_COMPR_FL) /* 'c' */
{ "nocompress", L"nocompress", FS_COMPR_FL, 0 },
#elif defined(EXT2_COMPR_FL) /* 'c' */
{ "nocompress", L"nocompress", EXT2_COMPR_FL, 0 }, { "nocompress", L"nocompress", EXT2_COMPR_FL, 0 },
#endif #endif
#ifdef EXT2_NOATIME_FL /* 'A' */ #if defined(FS_NOATIME_FL) /* 'A' */
{ "noatime", L"noatime", 0, FS_NOATIME_FL},
#elif defined(EXT2_NOATIME_FL) /* 'A' */
{ "noatime", L"noatime", 0, EXT2_NOATIME_FL}, { "noatime", L"noatime", 0, EXT2_NOATIME_FL},
#endif #endif
#ifdef EXT2_DIRTY_FL #if defined(FS_DIRTY_FL)
{ "nocompdirty",L"nocompdirty", FS_DIRTY_FL, 0},
#elif defined(EXT2_DIRTY_FL)
{ "nocompdirty",L"nocompdirty", EXT2_DIRTY_FL, 0}, { "nocompdirty",L"nocompdirty", EXT2_DIRTY_FL, 0},
#endif #endif
#ifdef EXT2_COMPRBLK_FL #if defined(FS_COMPRBLK_FL)
#ifdef EXT2_NOCOMPR_FL #if defined(FS_NOCOMPR_FL)
{ "nocomprblk", L"nocomprblk", FS_COMPRBLK_FL, FS_NOCOMPR_FL},
#else
{ "nocomprblk", L"nocomprblk", FS_COMPRBLK_FL, 0},
#endif
#elif defined(EXT2_COMPRBLK_FL)
#if defined(EXT2_NOCOMPR_FL)
{ "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, EXT2_NOCOMPR_FL}, { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, EXT2_NOCOMPR_FL},
#else #else
{ "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, 0}, { "nocomprblk", L"nocomprblk", EXT2_COMPRBLK_FL, 0},
#endif #endif
#endif #endif
#ifdef EXT2_DIRSYNC_FL #if defined(FS_DIRSYNC_FL)
{ "nodirsync", L"nodirsync", FS_DIRSYNC_FL, 0},
#elif defined(EXT2_DIRSYNC_FL)
{ "nodirsync", L"nodirsync", EXT2_DIRSYNC_FL, 0}, { "nodirsync", L"nodirsync", EXT2_DIRSYNC_FL, 0},
#endif #endif
#ifdef EXT2_INDEX_FL #if defined(FS_INDEX_FL)
{ "nohashidx", L"nohashidx", FS_INDEX_FL, 0},
#elif defined(EXT2_INDEX_FL)
{ "nohashidx", L"nohashidx", EXT2_INDEX_FL, 0}, { "nohashidx", L"nohashidx", EXT2_INDEX_FL, 0},
#endif #endif
#ifdef EXT2_IMAGIC_FL #if defined(FS_IMAGIC_FL)
{ "noimagic", L"noimagic", FS_IMAGIC_FL, 0},
#elif defined(EXT2_IMAGIC_FL)
{ "noimagic", L"noimagic", EXT2_IMAGIC_FL, 0}, { "noimagic", L"noimagic", EXT2_IMAGIC_FL, 0},
#endif #endif
#ifdef EXT3_JOURNAL_DATA_FL #if defined(FS_JOURNAL_DATA_FL)
{ "nojournal", L"nojournal", FS_JOURNAL_DATA_FL, 0},
#elif defined(EXT3_JOURNAL_DATA_FL)
{ "nojournal", L"nojournal", EXT3_JOURNAL_DATA_FL, 0}, { "nojournal", L"nojournal", EXT3_JOURNAL_DATA_FL, 0},
#endif #endif
#ifdef EXT2_SECRM_FL #if defined(FS_SECRM_FL)
{ "nosecuredeletion",L"nosecuredeletion",FS_SECRM_FL, 0},
#elif defined(EXT2_SECRM_FL)
{ "nosecuredeletion",L"nosecuredeletion",EXT2_SECRM_FL, 0}, { "nosecuredeletion",L"nosecuredeletion",EXT2_SECRM_FL, 0},
#endif #endif
#ifdef EXT2_SYNC_FL #if defined(FS_SYNC_FL)
{ "nosync", L"nosync", FS_SYNC_FL, 0},
#elif defined(EXT2_SYNC_FL)
{ "nosync", L"nosync", EXT2_SYNC_FL, 0}, { "nosync", L"nosync", EXT2_SYNC_FL, 0},
#endif #endif
#ifdef EXT2_NOTAIL_FL #if defined(FS_NOTAIL_FL)
{ "notail", L"notail", 0, FS_NOTAIL_FL},
#elif defined(EXT2_NOTAIL_FL)
{ "notail", L"notail", 0, EXT2_NOTAIL_FL}, { "notail", L"notail", 0, EXT2_NOTAIL_FL},
#endif #endif
#ifdef EXT2_TOPDIR_FL #if defined(FS_TOPDIR_FL)
{ "notopdir", L"notopdir", FS_TOPDIR_FL, 0},
#elif defined(EXT2_TOPDIR_FL)
{ "notopdir", L"notopdir", EXT2_TOPDIR_FL, 0}, { "notopdir", L"notopdir", EXT2_TOPDIR_FL, 0},
#endif #endif
#ifdef EXT2_RESERVED_FL #ifdef FS_ENCRYPT_FL
{ "noencrypt", L"noencrypt", FS_ENCRYPT_FL, 0},
#endif
#ifdef FS_HUGE_FILE_FL
{ "nohugefile", L"nohugefile", FS_HUGE_FILE_FL, 0},
#endif
#ifdef FS_EXTENT_FL
{ "noextent", L"noextent", FS_EXTENT_FL, 0},
#endif
#ifdef FS_EA_INODE_FL
{ "noeainode", L"noeainode", FS_EA_INODE_FL, 0},
#endif
#ifdef FS_EOFBLOCKS_FL
{ "noeofblocks",L"noeofblocks", FS_EOFBLOCKS_FL, 0},
#endif
#ifdef FS_NOCOW_FL
{ "nocow", L"nocow", FS_NOCOW_FL, 0},
#endif
#ifdef FS_INLINE_DATA_FL
{ "noinlinedata",L"noinlinedata", FS_INLINE_DATA_FL, 0},
#endif
#ifdef FS_PROJINHERIT_FL
{ "noprojinherit",L"noprojinherit", FS_PROJINHERIT_FL, 0},
#endif
#if defined(FS_RESERVED_FL)
{ "noreserved", L"noreserved", FS_RESERVED_FL, 0},
#elif defined(EXT2_RESERVED_FL)
{ "noreserved", L"noreserved", EXT2_RESERVED_FL, 0}, { "noreserved", L"noreserved", EXT2_RESERVED_FL, 0},
#endif #endif
{ NULL, NULL, 0, 0 } { NULL, NULL, 0, 0 }
}; };
@@ -30,7 +30,7 @@
#define ARCHIVE_ENTRY_H_INCLUDED #define ARCHIVE_ENTRY_H_INCLUDED
/* Note: Compiler will complain if this does not match archive.h! */ /* Note: Compiler will complain if this does not match archive.h! */
#define ARCHIVE_VERSION_NUMBER 3003000 #define ARCHIVE_VERSION_NUMBER 3003001
/* /*
* Note: archive_entry.h is for use outside of libarchive; the * Note: archive_entry.h is for use outside of libarchive; the
@@ -76,6 +76,10 @@ __hmac_sha1_cleanup(archive_hmac_sha1_ctx *ctx)
#elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H) #elif defined(_WIN32) && !defined(__CYGWIN__) && defined(HAVE_BCRYPT_H)
#ifndef BCRYPT_HASH_REUSABLE_FLAG
# define BCRYPT_HASH_REUSABLE_FLAG 0x00000020
#endif
static int static int
__hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len) __hmac_sha1_init(archive_hmac_sha1_ctx *ctx, const uint8_t *key, size_t key_len)
{ {
@@ -203,15 +203,17 @@ archive_read_disk_entry_from_file(struct archive *_a,
#ifdef HAVE_STRUCT_STAT_ST_FLAGS #ifdef HAVE_STRUCT_STAT_ST_FLAGS
/* On FreeBSD, we get flags for free with the stat. */ /* On FreeBSD, we get flags for free with the stat. */
/* TODO: Does this belong in copy_stat()? */ /* TODO: Does this belong in copy_stat()? */
if (st->st_flags != 0) if ((a->flags & ARCHIVE_READDISK_NO_FFLAGS) == 0 && st->st_flags != 0)
archive_entry_set_fflags(entry, st->st_flags, 0); archive_entry_set_fflags(entry, st->st_flags, 0);
#endif #endif
#if defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS) #if (defined(FS_IOC_GETFLAGS) && defined(HAVE_WORKING_FS_IOC_GETFLAGS)) || \
(defined(EXT2_IOC_GETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS))
/* Linux requires an extra ioctl to pull the flags. Although /* Linux requires an extra ioctl to pull the flags. Although
* this is an extra step, it has a nice side-effect: We get an * this is an extra step, it has a nice side-effect: We get an
* open file descriptor which we can use in the subsequent lookups. */ * open file descriptor which we can use in the subsequent lookups. */
if ((S_ISREG(st->st_mode) || S_ISDIR(st->st_mode))) { if ((a->flags & ARCHIVE_READDISK_NO_FFLAGS) == 0 &&
(S_ISREG(st->st_mode) || S_ISDIR(st->st_mode))) {
if (fd < 0) { if (fd < 0) {
if (a->tree != NULL) if (a->tree != NULL)
fd = a->open_on_current_dir(a->tree, path, fd = a->open_on_current_dir(a->tree, path,
@@ -223,7 +225,13 @@ archive_read_disk_entry_from_file(struct archive *_a,
} }
if (fd >= 0) { if (fd >= 0) {
int stflags; int stflags;
r = ioctl(fd, EXT2_IOC_GETFLAGS, &stflags); r = ioctl(fd,
#if defined(FS_IOC_GETFLAGS)
FS_IOC_GETFLAGS,
#else
EXT2_IOC_GETFLAGS,
#endif
&stflags);
if (r == 0 && stflags != 0) if (r == 0 && stflags != 0)
archive_entry_set_fflags(entry, stflags, 0); archive_entry_set_fflags(entry, stflags, 0);
} }
@@ -269,13 +277,15 @@ archive_read_disk_entry_from_file(struct archive *_a,
} }
#endif /* HAVE_READLINK || HAVE_READLINKAT */ #endif /* HAVE_READLINK || HAVE_READLINKAT */
r = setup_acls(a, entry, &fd); r = 0;
if (!a->suppress_xattr) { if ((a->flags & ARCHIVE_READDISK_NO_ACL) == 0)
r = setup_acls(a, entry, &fd);
if ((a->flags & ARCHIVE_READDISK_NO_XATTR) == 0) {
r1 = setup_xattrs(a, entry, &fd); r1 = setup_xattrs(a, entry, &fd);
if (r1 < r) if (r1 < r)
r = r1; r = r1;
} }
if (a->enable_copyfile) { if (a->flags & ARCHIVE_READDISK_MAC_COPYFILE) {
r1 = setup_mac_metadata(a, entry, &fd); r1 = setup_mac_metadata(a, entry, &fd);
if (r1 < r) if (r1 < r)
r = r1; r = r1;
@@ -465,8 +465,7 @@ archive_read_disk_new(void)
a->entry = archive_entry_new2(&a->archive); a->entry = archive_entry_new2(&a->archive);
a->lookup_uname = trivial_lookup_uname; a->lookup_uname = trivial_lookup_uname;
a->lookup_gname = trivial_lookup_gname; a->lookup_gname = trivial_lookup_gname;
a->enable_copyfile = 1; a->flags = ARCHIVE_READDISK_MAC_COPYFILE;
a->traverse_mount_points = 1;
a->open_on_current_dir = open_on_current_dir; a->open_on_current_dir = open_on_current_dir;
a->tree_current_dir_fd = tree_current_dir_fd; a->tree_current_dir_fd = tree_current_dir_fd;
a->tree_enter_working_dir = tree_enter_working_dir; a->tree_enter_working_dir = tree_enter_working_dir;
@@ -563,25 +562,19 @@ archive_read_disk_set_symlink_hybrid(struct archive *_a)
int int
archive_read_disk_set_atime_restored(struct archive *_a) archive_read_disk_set_atime_restored(struct archive *_a)
{ {
#ifndef HAVE_UTIMES
static int warning_done = 0;
#endif
struct archive_read_disk *a = (struct archive_read_disk *)_a; struct archive_read_disk *a = (struct archive_read_disk *)_a;
archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime"); ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime");
#ifdef HAVE_UTIMES #ifdef HAVE_UTIMES
a->restore_time = 1; a->flags |= ARCHIVE_READDISK_RESTORE_ATIME;
if (a->tree != NULL) if (a->tree != NULL)
a->tree->flags |= needsRestoreTimes; a->tree->flags |= needsRestoreTimes;
return (ARCHIVE_OK); return (ARCHIVE_OK);
#else #else
if (warning_done) /* Display warning and unset flag */
/* Warning was already emitted; suppress further warnings. */
return (ARCHIVE_OK);
archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC, archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
"Cannot restore access time on this system"); "Cannot restore access time on this system");
warning_done = 1; a->flags &= ~ARCHIVE_READDISK_RESTORE_ATIME;
return (ARCHIVE_WARN); return (ARCHIVE_WARN);
#endif #endif
} }
@@ -595,29 +588,14 @@ archive_read_disk_set_behavior(struct archive *_a, int flags)
archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump"); ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump");
a->flags = flags;
if (flags & ARCHIVE_READDISK_RESTORE_ATIME) if (flags & ARCHIVE_READDISK_RESTORE_ATIME)
r = archive_read_disk_set_atime_restored(_a); r = archive_read_disk_set_atime_restored(_a);
else { else {
a->restore_time = 0;
if (a->tree != NULL) if (a->tree != NULL)
a->tree->flags &= ~needsRestoreTimes; a->tree->flags &= ~needsRestoreTimes;
} }
if (flags & ARCHIVE_READDISK_HONOR_NODUMP)
a->honor_nodump = 1;
else
a->honor_nodump = 0;
if (flags & ARCHIVE_READDISK_MAC_COPYFILE)
a->enable_copyfile = 1;
else
a->enable_copyfile = 0;
if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS)
a->traverse_mount_points = 0;
else
a->traverse_mount_points = 1;
if (flags & ARCHIVE_READDISK_NO_XATTR)
a->suppress_xattr = 1;
else
a->suppress_xattr = 0;
return (r); return (r);
} }
@@ -918,7 +896,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
} while (lst == NULL); } while (lst == NULL);
#ifdef __APPLE__ #ifdef __APPLE__
if (a->enable_copyfile) { if (a->flags & ARCHIVE_READDISK_MAC_COPYFILE) {
/* If we're using copyfile(), ignore "._XXX" files. */ /* If we're using copyfile(), ignore "._XXX" files. */
const char *bname = strrchr(tree_current_path(t), '/'); const char *bname = strrchr(tree_current_path(t), '/');
if (bname == NULL) if (bname == NULL)
@@ -989,7 +967,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
} }
if (t->initial_filesystem_id == -1) if (t->initial_filesystem_id == -1)
t->initial_filesystem_id = t->current_filesystem_id; t->initial_filesystem_id = t->current_filesystem_id;
if (!a->traverse_mount_points) { if (a->flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) {
if (t->initial_filesystem_id != t->current_filesystem_id) if (t->initial_filesystem_id != t->current_filesystem_id)
descend = 0; descend = 0;
} }
@@ -999,12 +977,14 @@ next_entry(struct archive_read_disk *a, struct tree *t,
* Honor nodump flag. * Honor nodump flag.
* If the file is marked with nodump flag, do not return this entry. * If the file is marked with nodump flag, do not return this entry.
*/ */
if (a->honor_nodump) { if (a->flags & ARCHIVE_READDISK_HONOR_NODUMP) {
#if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP) #if defined(HAVE_STRUCT_STAT_ST_FLAGS) && defined(UF_NODUMP)
if (st->st_flags & UF_NODUMP) if (st->st_flags & UF_NODUMP)
return (ARCHIVE_RETRY); return (ARCHIVE_RETRY);
#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL) &&\ #elif (defined(FS_IOC_GETFLAGS) && defined(FS_NODUMP_FL) && \
defined(HAVE_WORKING_EXT2_IOC_GETFLAGS) defined(HAVE_WORKING_FS_IOC_GETFLAGS)) || \
(defined(EXT2_IOC_GETFLAGS) && defined(EXT2_NODUMP_FL) && \
defined(HAVE_WORKING_EXT2_IOC_GETFLAGS))
if (S_ISREG(st->st_mode) || S_ISDIR(st->st_mode)) { if (S_ISREG(st->st_mode) || S_ISDIR(st->st_mode)) {
int stflags; int stflags;
@@ -1013,9 +993,18 @@ next_entry(struct archive_read_disk *a, struct tree *t,
O_RDONLY | O_NONBLOCK | O_CLOEXEC); O_RDONLY | O_NONBLOCK | O_CLOEXEC);
__archive_ensure_cloexec_flag(t->entry_fd); __archive_ensure_cloexec_flag(t->entry_fd);
if (t->entry_fd >= 0) { if (t->entry_fd >= 0) {
r = ioctl(t->entry_fd, EXT2_IOC_GETFLAGS, r = ioctl(t->entry_fd,
#ifdef FS_IOC_GETFLAGS
FS_IOC_GETFLAGS,
#else
EXT2_IOC_GETFLAGS,
#endif
&stflags); &stflags);
#ifdef FS_NODUMP_FL
if (r == 0 && (stflags & FS_NODUMP_FL) != 0)
#else
if (r == 0 && (stflags & EXT2_NODUMP_FL) != 0) if (r == 0 && (stflags & EXT2_NODUMP_FL) != 0)
#endif
return (ARCHIVE_RETRY); return (ARCHIVE_RETRY);
} }
} }
@@ -1340,10 +1329,11 @@ _archive_read_disk_open(struct archive *_a, const char *pathname)
struct archive_read_disk *a = (struct archive_read_disk *)_a; struct archive_read_disk *a = (struct archive_read_disk *)_a;
if (a->tree != NULL) if (a->tree != NULL)
a->tree = tree_reopen(a->tree, pathname, a->restore_time); a->tree = tree_reopen(a->tree, pathname,
a->flags & ARCHIVE_READDISK_RESTORE_ATIME);
else else
a->tree = tree_open(pathname, a->symlink_mode, a->tree = tree_open(pathname, a->symlink_mode,
a->restore_time); a->flags & ARCHIVE_READDISK_RESTORE_ATIME);
if (a->tree == NULL) { if (a->tree == NULL) {
archive_set_error(&a->archive, ENOMEM, archive_set_error(&a->archive, ENOMEM,
"Can't allocate tar data"); "Can't allocate tar data");
@@ -2132,7 +2122,7 @@ tree_open(const char *path, int symlink_mode, int restore_time)
static struct tree * static struct tree *
tree_reopen(struct tree *t, const char *path, int restore_time) tree_reopen(struct tree *t, const char *path, int restore_time)
{ {
t->flags = (restore_time)?needsRestoreTimes:0; t->flags = (restore_time != 0)?needsRestoreTimes:0;
t->flags |= onInitialDir; t->flags |= onInitialDir;
t->visit_type = 0; t->visit_type = 0;
t->tree_errno = 0; t->tree_errno = 0;
@@ -63,16 +63,8 @@ struct archive_read_disk {
int (*tree_current_dir_fd)(struct tree*); int (*tree_current_dir_fd)(struct tree*);
int (*tree_enter_working_dir)(struct tree*); int (*tree_enter_working_dir)(struct tree*);
/* Set 1 if users request to restore atime . */ /* Bitfield with ARCHIVE_READDISK_* tunables */
int restore_time; int flags;
/* Set 1 if users request to honor nodump flag . */
int honor_nodump;
/* Set 1 if users request to enable mac copyfile. */
int enable_copyfile;
/* Set 1 if users request to traverse mount points. */
int traverse_mount_points;
/* Set 1 if users want to suppress xattr information. */
int suppress_xattr;
const char * (*lookup_gname)(void *private, int64_t gid); const char * (*lookup_gname)(void *private, int64_t gid);
void (*cleanup_gname)(void *private); void (*cleanup_gname)(void *private);
@@ -398,8 +398,7 @@ archive_read_disk_new(void)
a->entry = archive_entry_new2(&a->archive); a->entry = archive_entry_new2(&a->archive);
a->lookup_uname = trivial_lookup_uname; a->lookup_uname = trivial_lookup_uname;
a->lookup_gname = trivial_lookup_gname; a->lookup_gname = trivial_lookup_gname;
a->enable_copyfile = 1; a->flags = ARCHIVE_READDISK_MAC_COPYFILE;
a->traverse_mount_points = 1;
return (&a->archive); return (&a->archive);
} }
@@ -495,7 +494,7 @@ archive_read_disk_set_atime_restored(struct archive *_a)
struct archive_read_disk *a = (struct archive_read_disk *)_a; struct archive_read_disk *a = (struct archive_read_disk *)_a;
archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime"); ARCHIVE_STATE_ANY, "archive_read_disk_restore_atime");
a->restore_time = 1; a->flags |= ARCHIVE_READDISK_RESTORE_ATIME;
if (a->tree != NULL) if (a->tree != NULL)
a->tree->flags |= needsRestoreTimes; a->tree->flags |= needsRestoreTimes;
return (ARCHIVE_OK); return (ARCHIVE_OK);
@@ -510,25 +509,14 @@ archive_read_disk_set_behavior(struct archive *_a, int flags)
archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC, archive_check_magic(_a, ARCHIVE_READ_DISK_MAGIC,
ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump"); ARCHIVE_STATE_ANY, "archive_read_disk_honor_nodump");
a->flags = flags;
if (flags & ARCHIVE_READDISK_RESTORE_ATIME) if (flags & ARCHIVE_READDISK_RESTORE_ATIME)
r = archive_read_disk_set_atime_restored(_a); r = archive_read_disk_set_atime_restored(_a);
else { else {
a->restore_time = 0;
if (a->tree != NULL) if (a->tree != NULL)
a->tree->flags &= ~needsRestoreTimes; a->tree->flags &= ~needsRestoreTimes;
} }
if (flags & ARCHIVE_READDISK_HONOR_NODUMP)
a->honor_nodump = 1;
else
a->honor_nodump = 0;
if (flags & ARCHIVE_READDISK_MAC_COPYFILE)
a->enable_copyfile = 1;
else
a->enable_copyfile = 0;
if (flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS)
a->traverse_mount_points = 0;
else
a->traverse_mount_points = 1;
return (r); return (r);
} }
@@ -852,7 +840,7 @@ next_entry(struct archive_read_disk *a, struct tree *t,
} }
if (t->initial_filesystem_id == -1) if (t->initial_filesystem_id == -1)
t->initial_filesystem_id = t->current_filesystem_id; t->initial_filesystem_id = t->current_filesystem_id;
if (!a->traverse_mount_points) { if (a->flags & ARCHIVE_READDISK_NO_TRAVERSE_MOUNTS) {
if (t->initial_filesystem_id != t->current_filesystem_id) if (t->initial_filesystem_id != t->current_filesystem_id)
return (ARCHIVE_RETRY); return (ARCHIVE_RETRY);
} }
@@ -1219,9 +1207,11 @@ _archive_read_disk_open_w(struct archive *_a, const wchar_t *pathname)
struct archive_read_disk *a = (struct archive_read_disk *)_a; struct archive_read_disk *a = (struct archive_read_disk *)_a;
if (a->tree != NULL) if (a->tree != NULL)
a->tree = tree_reopen(a->tree, pathname, a->restore_time); a->tree = tree_reopen(a->tree, pathname,
a->flags & ARCHIVE_READDISK_RESTORE_ATIME);
else else
a->tree = tree_open(pathname, a->symlink_mode, a->restore_time); a->tree = tree_open(pathname, a->symlink_mode,
a->flags & ARCHIVE_READDISK_RESTORE_ATIME);
if (a->tree == NULL) { if (a->tree == NULL) {
archive_set_error(&a->archive, ENOMEM, archive_set_error(&a->archive, ENOMEM,
"Can't allocate directory traversal data"); "Can't allocate directory traversal data");
@@ -1519,7 +1509,7 @@ tree_reopen(struct tree *t, const wchar_t *path, int restore_time)
struct archive_wstring ws; struct archive_wstring ws;
wchar_t *pathname, *p, *base; wchar_t *pathname, *p, *base;
t->flags = (restore_time)?needsRestoreTimes:0; t->flags = (restore_time != 0)?needsRestoreTimes:0;
t->visit_type = 0; t->visit_type = 0;
t->tree_errno = 0; t->tree_errno = 0;
t->full_path_dir_length = 0; t->full_path_dir_length = 0;
@@ -531,10 +531,6 @@ time_from_tm(struct tm *t)
#endif #endif
} }
static int la_isblank(int c) {
return c == ' ' || c == '\t';
}
static time_t static time_t
xstrpisotime(const char *s, char **endptr) xstrpisotime(const char *s, char **endptr)
{ {
@@ -547,7 +543,7 @@ xstrpisotime(const char *s, char **endptr)
/* as a courtesy to our callers, and since this is a non-standard /* as a courtesy to our callers, and since this is a non-standard
* routine, we skip leading whitespace */ * routine, we skip leading whitespace */
while (la_isblank((unsigned char)*s)) while (*s == ' ' || *s == '\t')
++s; ++s;
/* read year */ /* read year */
@@ -593,6 +589,7 @@ static unsigned int
_warc_rdver(const char *buf, size_t bsz) _warc_rdver(const char *buf, size_t bsz)
{ {
static const char magic[] = "WARC/"; static const char magic[] = "WARC/";
const char *c;
unsigned int ver = 0U; unsigned int ver = 0U;
unsigned int end = 0U; unsigned int end = 0U;
@@ -619,11 +616,12 @@ _warc_rdver(const char *buf, size_t bsz)
* WARC below version 0.12 has a space-separated header * WARC below version 0.12 has a space-separated header
* WARC 0.12 and above terminates the version with a CRLF * WARC 0.12 and above terminates the version with a CRLF
*/ */
c = buf + 3U + end;
if (ver >= 1200U) { if (ver >= 1200U) {
if (memcmp(buf + 3U + end, "\r\n", 2U) != 0) if (memcmp(c, "\r\n", 2U) != 0)
ver = 0U; ver = 0U;
} else if (ver < 1200U) { } else if (ver < 1200U) {
if (!la_isblank(*(buf + 3U + end))) if (*c != ' ' && *c != '\t')
ver = 0U; ver = 0U;
} }
} }
@@ -647,7 +645,7 @@ _warc_rdtyp(const char *buf, size_t bsz)
} }
/* overread whitespace */ /* overread whitespace */
while (val < eol && la_isblank((unsigned char)*val)) while (val < eol && (*val == ' ' || *val == '\t'))
++val; ++val;
if (val + 8U == eol) { if (val + 8U == eol) {
@@ -677,7 +675,7 @@ _warc_rduri(const char *buf, size_t bsz)
return res; return res;
} }
while (val < eol && la_isblank((unsigned char)*val)) while (val < eol && (*val == ' ' || *val == '\t'))
++val; ++val;
/* overread URL designators */ /* overread URL designators */
@@ -735,7 +733,7 @@ _warc_rdlen(const char *buf, size_t bsz)
} }
/* skip leading whitespace */ /* skip leading whitespace */
while (val < eol && la_isblank(*val)) while (val < eol && (*val == ' ' || *val == '\t'))
val++; val++;
/* there must be at least one digit */ /* there must be at least one digit */
if (!isdigit(*val)) if (!isdigit(*val))
@@ -1712,7 +1712,8 @@ _archive_write_disk_finish_entry(struct archive *_a)
const void *metadata; const void *metadata;
size_t metadata_size; size_t metadata_size;
metadata = archive_entry_mac_metadata(a->entry, &metadata_size); metadata = archive_entry_mac_metadata(a->entry, &metadata_size);
if (metadata == NULL || metadata_size == 0) { if ((a->todo & TODO_MAC_METADATA) == 0 ||
metadata == NULL || metadata_size == 0) {
#endif #endif
r2 = archive_write_disk_set_acls(&a->archive, a->fd, r2 = archive_write_disk_set_acls(&a->archive, a->fd,
archive_entry_pathname(a->entry), archive_entry_pathname(a->entry),
@@ -2293,7 +2294,8 @@ _archive_write_disk_close(struct archive *_a)
chmod(p->name, p->mode); chmod(p->name, p->mode);
if (p->fixup & TODO_ACLS) if (p->fixup & TODO_ACLS)
#ifdef HAVE_DARWIN_ACL #ifdef HAVE_DARWIN_ACL
if (p->mac_metadata == NULL || if ((p->fixup & TODO_MAC_METADATA) == 0 ||
p->mac_metadata == NULL ||
p->mac_metadata_size == 0) p->mac_metadata_size == 0)
#endif #endif
archive_write_disk_set_acls(&a->archive, archive_write_disk_set_acls(&a->archive,
@@ -3465,12 +3467,19 @@ set_fflags(struct archive_write_disk *a)
#ifdef UF_APPEND #ifdef UF_APPEND
critical_flags |= UF_APPEND; critical_flags |= UF_APPEND;
#endif #endif
#ifdef EXT2_APPEND_FL #if defined(FS_APPEND_FL)
critical_flags |= FS_APPEND_FL;
#elif defined(EXT2_APPEND_FL)
critical_flags |= EXT2_APPEND_FL; critical_flags |= EXT2_APPEND_FL;
#endif #endif
#ifdef EXT2_IMMUTABLE_FL #if defined(FS_IMMUTABLE_FL)
critical_flags |= FS_IMMUTABLE_FL;
#elif defined(EXT2_IMMUTABLE_FL)
critical_flags |= EXT2_IMMUTABLE_FL; critical_flags |= EXT2_IMMUTABLE_FL;
#endif #endif
#ifdef FS_JOURNAL_DATA_FL
critical_flags |= FS_JOURNAL_DATA_FL;
#endif
if (a->todo & TODO_FFLAGS) { if (a->todo & TODO_FFLAGS) {
archive_entry_fflags(a->entry, &set, &clear); archive_entry_fflags(a->entry, &set, &clear);
@@ -3582,7 +3591,10 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
return (ARCHIVE_WARN); return (ARCHIVE_WARN);
} }
#elif defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS) && defined(HAVE_WORKING_EXT2_IOC_GETFLAGS) #elif (defined(FS_IOC_GETFLAGS) && defined(FS_IOC_SETFLAGS) && \
defined(HAVE_WORKING_FS_IOC_GETFLAGS)) || \
(defined(EXT2_IOC_GETFLAGS) && defined(EXT2_IOC_SETFLAGS) && \
defined(HAVE_WORKING_EXT2_IOC_GETFLAGS))
/* /*
* Linux uses ioctl() to read and write file flags. * Linux uses ioctl() to read and write file flags.
*/ */
@@ -3595,7 +3607,7 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
int newflags, oldflags; int newflags, oldflags;
int sf_mask = 0; int sf_mask = 0;
if (set == 0 && clear == 0) if (set == 0 && clear == 0)
return (ARCHIVE_OK); return (ARCHIVE_OK);
/* Only regular files and dirs can have flags. */ /* Only regular files and dirs can have flags. */
if (!S_ISREG(mode) && !S_ISDIR(mode)) if (!S_ISREG(mode) && !S_ISDIR(mode))
@@ -3616,11 +3628,18 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
* defines. (?) The code below degrades reasonably gracefully * defines. (?) The code below degrades reasonably gracefully
* if sf_mask is incomplete. * if sf_mask is incomplete.
*/ */
#ifdef EXT2_IMMUTABLE_FL #if defined(FS_IMMUTABLE_FL)
sf_mask |= FS_IMMUTABLE_FL;
#elif defined(EXT2_IMMUTABLE_FL)
sf_mask |= EXT2_IMMUTABLE_FL; sf_mask |= EXT2_IMMUTABLE_FL;
#endif #endif
#ifdef EXT2_APPEND_FL #if defined(FS_APPEND_FL)
sf_mask |= FS_APPEND_FL;
#elif defined(EXT2_APPEND_FL)
sf_mask |= EXT2_APPEND_FL; sf_mask |= EXT2_APPEND_FL;
#endif
#if defined(FS_JOURNAL_DATA_FL)
sf_mask |= FS_JOURNAL_DATA_FL;
#endif #endif
/* /*
* XXX As above, this would be way simpler if we didn't have * XXX As above, this would be way simpler if we didn't have
@@ -3629,12 +3648,24 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
ret = ARCHIVE_OK; ret = ARCHIVE_OK;
/* Read the current file flags. */ /* Read the current file flags. */
if (ioctl(myfd, EXT2_IOC_GETFLAGS, &oldflags) < 0) if (ioctl(myfd,
#ifdef FS_IOC_GETFLAGS
FS_IOC_GETFLAGS,
#else
EXT2_IOC_GETFLAGS,
#endif
&oldflags) < 0)
goto fail; goto fail;
/* Try setting the flags as given. */ /* Try setting the flags as given. */
newflags = (oldflags & ~clear) | set; newflags = (oldflags & ~clear) | set;
if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0) if (ioctl(myfd,
#ifdef FS_IOC_SETFLAGS
FS_IOC_SETFLAGS,
#else
EXT2_IOC_SETFLAGS,
#endif
&newflags) >= 0)
goto cleanup; goto cleanup;
if (errno != EPERM) if (errno != EPERM)
goto fail; goto fail;
@@ -3643,7 +3674,13 @@ set_fflags_platform(struct archive_write_disk *a, int fd, const char *name,
newflags &= ~sf_mask; newflags &= ~sf_mask;
oldflags &= sf_mask; oldflags &= sf_mask;
newflags |= oldflags; newflags |= oldflags;
if (ioctl(myfd, EXT2_IOC_SETFLAGS, &newflags) >= 0) if (ioctl(myfd,
#ifdef FS_IOC_SETFLAGS
FS_IOC_SETFLAGS,
#else
EXT2_IOC_SETFLAGS,
#endif
&newflags) >= 0)
goto cleanup; goto cleanup;
/* We couldn't set the flags, so report the failure. */ /* We couldn't set the flags, so report the failure. */