summaryrefslogtreecommitdiffstats
path: root/contrib/libarchive/tar/write.c
diff options
context:
space:
mode:
authormm <mm@FreeBSD.org>2017-03-16 23:08:18 +0000
committermm <mm@FreeBSD.org>2017-03-16 23:08:18 +0000
commit7fe2e9ed994e8a05f0f3633a678c70da7f72575e (patch)
tree87a6d288519799b4a0946d55b736f27b0635ceae /contrib/libarchive/tar/write.c
parent05a2c39b0e37a34bbd587cca6f54c8e9ba90b5e3 (diff)
downloadFreeBSD-src-7fe2e9ed994e8a05f0f3633a678c70da7f72575e.zip
FreeBSD-src-7fe2e9ed994e8a05f0f3633a678c70da7f72575e.tar.gz
MFC r314571:
Update libarchive to version 3.3.1 (and sync with latest vendor dist) Notable vendor changes: PR #501: improvements in ACL path handling PR #724: fix hang when reading malformed cpio files PR #864: fix out of bounds read with malformed GNU tar archives Documentation, style, test suite improvements and typo fixes. New options to bsdtar that enable or disable reading and/or writing of: Access Control Lists (--acls, --no-acls) Extended file flags (--fflags, --no-fflags) Extended attributes (--xattrs, --no-xattrs) Mac OS X metadata (Mac OS X only) (--mac-metadata, --no-mac-metadata)
Diffstat (limited to 'contrib/libarchive/tar/write.c')
-rw-r--r--contrib/libarchive/tar/write.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/contrib/libarchive/tar/write.c b/contrib/libarchive/tar/write.c
index 4265d14..4c9bb65 100644
--- a/contrib/libarchive/tar/write.c
+++ b/contrib/libarchive/tar/write.c
@@ -583,7 +583,7 @@ cleanup:
archive_read_free(bsdtar->diskreader);
bsdtar->diskreader = NULL;
- if (bsdtar->option_totals) {
+ if (bsdtar->flags & OPTFLAG_TOTALS) {
fprintf(stderr, "Total bytes written: %s\n",
tar_i64toa(archive_filter_bytes(a, -1)));
}
@@ -606,7 +606,8 @@ archive_names_from_file(struct bsdtar *bsdtar, struct archive *a)
bsdtar->next_line_is_dir = 0;
- lr = lafe_line_reader(bsdtar->names_from_file, bsdtar->option_null);
+ lr = lafe_line_reader(bsdtar->names_from_file,
+ (bsdtar->flags & OPTFLAG_NULL));
while ((line = lafe_line_reader_next(lr)) != NULL) {
if (bsdtar->next_line_is_dir) {
if (*line != '\0')
@@ -617,7 +618,8 @@ archive_names_from_file(struct bsdtar *bsdtar, struct archive *a)
bsdtar->return_value = 1;
}
bsdtar->next_line_is_dir = 0;
- } else if (!bsdtar->option_null && strcmp(line, "-C") == 0)
+ } else if (((bsdtar->flags & OPTFLAG_NULL) == 0) &&
+ strcmp(line, "-C") == 0)
bsdtar->next_line_is_dir = 1;
else {
if (*line != '/')
@@ -690,7 +692,7 @@ append_archive(struct bsdtar *bsdtar, struct archive *a, struct archive *ina)
while (ARCHIVE_OK == (e = archive_read_next_header(ina, &in_entry))) {
if (archive_match_excluded(bsdtar->matching, in_entry))
continue;
- if (bsdtar->option_interactive &&
+ if ((bsdtar->flags & OPTFLAG_INTERACTIVE) &&
!yes("copy '%s'", archive_entry_pathname(in_entry)))
continue;
if (bsdtar->verbose > 1) {
@@ -809,11 +811,11 @@ excluded_callback(struct archive *a, void *_data, struct archive_entry *entry)
{
struct bsdtar *bsdtar = (struct bsdtar *)_data;
- if (bsdtar->option_no_subdirs)
+ if (bsdtar->flags & OPTFLAG_NO_SUBDIRS)
return;
if (!archive_read_disk_can_descend(a))
return;
- if (bsdtar->option_interactive &&
+ if ((bsdtar->flags & OPTFLAG_INTERACTIVE) &&
!yes("add '%s'", archive_entry_pathname(entry)))
return;
archive_read_disk_descend(a);
@@ -844,12 +846,13 @@ metadata_filter(struct archive *a, void *_data, struct archive_entry *entry)
* check would veto this file, we shouldn't bother
* the user with it.
*/
- if (bsdtar->option_interactive &&
+ if ((bsdtar->flags & OPTFLAG_INTERACTIVE) &&
!yes("add '%s'", archive_entry_pathname(entry)))
return (0);
/* Note: if user vetoes, we won't descend. */
- if (!bsdtar->option_no_subdirs && archive_read_disk_can_descend(a))
+ if (((bsdtar->flags & OPTFLAG_NO_SUBDIRS) == 0) &&
+ archive_read_disk_can_descend(a))
archive_read_disk_descend(a);
return (1);
@@ -1010,7 +1013,7 @@ report_write(struct bsdtar *bsdtar, struct archive *a,
uncomp = archive_filter_bytes(a, 0);
fprintf(stderr, "In: %d files, %s bytes;",
archive_file_count(a), tar_i64toa(uncomp));
- if (comp > uncomp)
+ if (comp >= uncomp)
compression = 0;
else
compression = (int)((uncomp - comp) * 100 / uncomp);
OpenPOWER on IntegriCloud