]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Add ARCHIVE_READDISK_NO_FFLAGS to suppress reading file flags from disk
authorMartin Matuska <martin@matuska.org>
Thu, 23 Feb 2017 11:02:13 +0000 (12:02 +0100)
committerMartin Matuska <martin@matuska.org>
Fri, 24 Feb 2017 01:16:00 +0000 (02:16 +0100)
libarchive/archive.h
libarchive/archive_read_disk_entry_from_file.c

index 20fa09b1d15b3e56edc68fa1d6e67f88fd15a8d0..e74be4d500dcef995449102d3f4ce20897840604 100644 (file)
@@ -1003,6 +1003,8 @@ __LA_DECL int  archive_read_disk_set_atime_restored(struct archive *);
 #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 *,
                    int flags);
index 603b70763b3d17cb101f3166279d6deb560c24e4..b2f1d17d9718fbf4e672ed2652df7968181b519f 100644 (file)
@@ -203,7 +203,7 @@ archive_read_disk_entry_from_file(struct archive *_a,
 #ifdef HAVE_STRUCT_STAT_ST_FLAGS
        /* On FreeBSD, we get flags for free with the 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);
 #endif
 
@@ -212,7 +212,8 @@ archive_read_disk_entry_from_file(struct archive *_a,
        /* Linux requires an extra ioctl to pull the flags.  Although
         * 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. */
-       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 (a->tree != NULL)
                                fd = a->open_on_current_dir(a->tree, path,