svn commit: r357785 - in head: contrib/libarchive contrib/libarchive/cat contrib/libarchive/cat/test contrib/libarchive/cpio contrib/libarchive/cpio/test contrib/libarchive/libarchive contrib/libar...

Martin Matuska mm at FreeBSD.org
Wed Feb 12 00:17:04 UTC 2020


Author: mm
Date: Wed Feb 12 00:16:56 2020
New Revision: 357785
URL: https://svnweb.freebsd.org/changeset/base/357785

Log:
  MFV r357783:
  Update libarchive to 3.4.2
  
  Relevant vendor changes:
    PR #1289: atomic extraction support (bsdtar -x --safe-writes)
    PR #1308: big endian fix for UTF16 support in LHA reader
    PR #1326: reject RAR5 files that declare invalid header flags
    Issue #987: fix support 7z archive entries with Delta filter
    Issue #1317: fix compression output buffer handling in XAR writer
    Issue #1319: fix uname or gname longer than 32 characters in pax writer
    Issue #1325: fix use after free when archiving hardlinks in ISO9660 or XAR
    Use localtime_r() and gmtime_r() instead of localtime() and gmtime()
  
  X-MFC-With:	r356212,r356365,r356416
  MFC after:	1 week

Added:
  head/contrib/libarchive/libarchive/archive_write_set_format_private.h
     - copied unchanged from r357783, vendor/libarchive/dist/libarchive/archive_write_set_format_private.h
  head/contrib/libarchive/libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu
     - copied unchanged from r357783, vendor/libarchive/dist/libarchive/test/test_read_format_7zip_delta4_lzma1.7z.uu
  head/contrib/libarchive/libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu
     - copied unchanged from r357783, vendor/libarchive/dist/libarchive/test/test_read_format_7zip_delta4_lzma2.7z.uu
  head/contrib/libarchive/libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu
     - copied unchanged from r357783, vendor/libarchive/dist/libarchive/test/test_read_format_rar5_block_size_is_too_small.rar.uu
  head/contrib/libarchive/tar/test/test_option_safe_writes.c
     - copied unchanged from r357783, vendor/libarchive/dist/tar/test/test_option_safe_writes.c
Modified:
  head/contrib/libarchive/NEWS
  head/contrib/libarchive/cat/bsdcat.h
  head/contrib/libarchive/cat/test/test_0.c
  head/contrib/libarchive/cpio/cpio.c
  head/contrib/libarchive/cpio/test/test_basic.c
  head/contrib/libarchive/cpio/test/test_format_newc.c
  head/contrib/libarchive/libarchive/archive.h
  head/contrib/libarchive/libarchive/archive_acl_private.h
  head/contrib/libarchive/libarchive/archive_blake2.h
  head/contrib/libarchive/libarchive/archive_blake2_impl.h
  head/contrib/libarchive/libarchive/archive_cmdline_private.h
  head/contrib/libarchive/libarchive/archive_crc32.h
  head/contrib/libarchive/libarchive/archive_cryptor_private.h
  head/contrib/libarchive/libarchive/archive_digest_private.h
  head/contrib/libarchive/libarchive/archive_endian.h
  head/contrib/libarchive/libarchive/archive_entry.c
  head/contrib/libarchive/libarchive/archive_entry.h
  head/contrib/libarchive/libarchive/archive_entry_locale.h
  head/contrib/libarchive/libarchive/archive_entry_private.h
  head/contrib/libarchive/libarchive/archive_getdate.c
  head/contrib/libarchive/libarchive/archive_getdate.h
  head/contrib/libarchive/libarchive/archive_hmac_private.h
  head/contrib/libarchive/libarchive/archive_openssl_evp_private.h
  head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h
  head/contrib/libarchive/libarchive/archive_options_private.h
  head/contrib/libarchive/libarchive/archive_pack_dev.c
  head/contrib/libarchive/libarchive/archive_pack_dev.h
  head/contrib/libarchive/libarchive/archive_pathmatch.h
  head/contrib/libarchive/libarchive/archive_platform_acl.h
  head/contrib/libarchive/libarchive/archive_platform_xattr.h
  head/contrib/libarchive/libarchive/archive_ppmd7.c
  head/contrib/libarchive/libarchive/archive_ppmd7_private.h
  head/contrib/libarchive/libarchive/archive_ppmd8_private.h
  head/contrib/libarchive/libarchive/archive_ppmd_private.h
  head/contrib/libarchive/libarchive/archive_private.h
  head/contrib/libarchive/libarchive/archive_random_private.h
  head/contrib/libarchive/libarchive/archive_rb.h
  head/contrib/libarchive/libarchive/archive_read.c
  head/contrib/libarchive/libarchive/archive_read_disk_posix.c
  head/contrib/libarchive/libarchive/archive_read_disk_private.h
  head/contrib/libarchive/libarchive/archive_read_private.h
  head/contrib/libarchive/libarchive/archive_read_set_options.3
  head/contrib/libarchive/libarchive/archive_read_support_filter_uu.c
  head/contrib/libarchive/libarchive/archive_read_support_format_7zip.c
  head/contrib/libarchive/libarchive/archive_read_support_format_lha.c
  head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c
  head/contrib/libarchive/libarchive/archive_read_support_format_rar.c
  head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c
  head/contrib/libarchive/libarchive/archive_read_support_format_warc.c
  head/contrib/libarchive/libarchive/archive_read_support_format_xar.c
  head/contrib/libarchive/libarchive/archive_string.c
  head/contrib/libarchive/libarchive/archive_string.h
  head/contrib/libarchive/libarchive/archive_string_composition.h
  head/contrib/libarchive/libarchive/archive_util.c
  head/contrib/libarchive/libarchive/archive_write_disk.3
  head/contrib/libarchive/libarchive/archive_write_disk_posix.c
  head/contrib/libarchive/libarchive/archive_write_disk_private.h
  head/contrib/libarchive/libarchive/archive_write_private.h
  head/contrib/libarchive/libarchive/archive_write_set_format.c
  head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c
  head/contrib/libarchive/libarchive/archive_write_set_format_ar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c
  head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c
  head/contrib/libarchive/libarchive/archive_write_set_format_gnutar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c
  head/contrib/libarchive/libarchive/archive_write_set_format_pax.c
  head/contrib/libarchive/libarchive/archive_write_set_format_shar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_ustar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_v7tar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_warc.c
  head/contrib/libarchive/libarchive/archive_write_set_format_xar.c
  head/contrib/libarchive/libarchive/archive_write_set_format_zip.c
  head/contrib/libarchive/libarchive/archive_write_set_options.3
  head/contrib/libarchive/libarchive/archive_xxhash.h
  head/contrib/libarchive/libarchive/filter_fork.h
  head/contrib/libarchive/libarchive/test/test_archive_write_set_format_filter_by_ext.c
  head/contrib/libarchive/libarchive/test/test_compat_zip.c
  head/contrib/libarchive/libarchive/test/test_fuzz.c
  head/contrib/libarchive/libarchive/test/test_read_extract.c
  head/contrib/libarchive/libarchive/test/test_read_format_7zip.c
  head/contrib/libarchive/libarchive/test/test_read_format_7zip_packinfo_digests.c
  head/contrib/libarchive/libarchive/test/test_read_format_gtar_sparse.c
  head/contrib/libarchive/libarchive/test/test_read_format_rar5.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_7075_utf8_paths.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_comment_stored.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_extra_padding.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_high_compression.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_jar.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_mac_metadata.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_malformed.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_msdos.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_nested.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_nofiletype.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_padded.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_sfx.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_with_invalid_traditional_eocd.c
  head/contrib/libarchive/libarchive/test/test_read_format_zip_zip64.c
  head/contrib/libarchive/libarchive/test/test_read_pax_truncated.c
  head/contrib/libarchive/libarchive/test/test_read_truncated_filter.c
  head/contrib/libarchive/libarchive/test/test_sparse_basic.c
  head/contrib/libarchive/libarchive/test/test_write_disk.c
  head/contrib/libarchive/libarchive/test/test_write_format_cpio_empty.c
  head/contrib/libarchive/libarchive/test/test_write_format_pax.c
  head/contrib/libarchive/libarchive/test/test_write_format_shar_empty.c
  head/contrib/libarchive/libarchive/test/test_write_format_tar.c
  head/contrib/libarchive/libarchive/test/test_write_format_tar_sparse.c
  head/contrib/libarchive/libarchive/test/test_write_format_xar.c
  head/contrib/libarchive/libarchive/test/test_write_format_zip_file.c
  head/contrib/libarchive/libarchive/test/test_write_format_zip_file_zip64.c
  head/contrib/libarchive/libarchive_fe/err.h
  head/contrib/libarchive/tar/bsdtar.1
  head/contrib/libarchive/tar/bsdtar.c
  head/contrib/libarchive/tar/bsdtar.h
  head/contrib/libarchive/tar/cmdline.c
  head/contrib/libarchive/tar/test/test_basic.c
  head/contrib/libarchive/tar/test/test_copy.c
  head/contrib/libarchive/tar/test/test_option_C_upper.c
  head/contrib/libarchive/tar/test/test_option_s.c
  head/contrib/libarchive/tar/util.c
  head/contrib/libarchive/test_utils/test_common.h
  head/contrib/libarchive/test_utils/test_main.c
  head/lib/libarchive/tests/Makefile
  head/usr.bin/bsdcat/Makefile
  head/usr.bin/cpio/Makefile
  head/usr.bin/tar/Makefile
  head/usr.bin/tar/tests/Makefile
Directory Properties:
  head/contrib/libarchive/   (props changed)

Modified: head/contrib/libarchive/NEWS
==============================================================================
--- head/contrib/libarchive/NEWS	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/NEWS	Wed Feb 12 00:16:56 2020	(r357785)
@@ -1,3 +1,11 @@
+Feb 11, 2020: libarchive 3.4.2 released
+
+Jan 23, 2020: Important fixes for writing XAR archives
+
+Jan 20, 2020: New tar option: --safe-writes (atomical file extraction)
+
+Jan 03, 2020: Support mbed TLS (PolarSSL) as optional crypto provider
+
 Dec 30, 2019: libarchive 3.4.1 released
 
 Dec 11, 2019: New pax write option "xattrhdr"

Modified: head/contrib/libarchive/cat/bsdcat.h
==============================================================================
--- head/contrib/libarchive/cat/bsdcat.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/cat/bsdcat.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -23,6 +23,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef BSDCAT_H_INCLUDED
+#define BSDCAT_H_INCLUDED
+
 #if defined(PLATFORM_CONFIG_H)
 /* Use hand-built config.h in environments that need it. */
 #include PLATFORM_CONFIG_H
@@ -54,3 +57,5 @@ void usage(FILE *stream, int eval);
 void bsdcat_next(void);
 void bsdcat_print_error(void);
 void bsdcat_read_to_stdout(const char* filename);
+
+#endif

Modified: head/contrib/libarchive/cat/test/test_0.c
==============================================================================
--- head/contrib/libarchive/cat/test/test_0.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/cat/test/test_0.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -59,7 +59,7 @@ DEFINE_TEST(test_0)
 	 * we know some option that will succeed.
 	 */
 	if (0 != systemf("%s --version >" DEV_NULL, testprog)) {
-		failure("Unable to successfully run: %s --version\n", testprog, testprog);
+		failure("Unable to successfully run: %s --version\n", testprog);
 		assert(0);
 	}
 

Modified: head/contrib/libarchive/cpio/cpio.c
==============================================================================
--- head/contrib/libarchive/cpio/cpio.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/cpio/cpio.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -1139,6 +1139,14 @@ list_item_verbose(struct cpio *cpio, struct archive_en
 	const char		*fmt;
 	time_t			 mtime;
 	static time_t		 now;
+	struct tm		*ltime;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+	struct tm		tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+	errno_t			terr;
+	__time64_t		tmptime;
+#endif
 
 	if (!now)
 		time(&now);
@@ -1186,7 +1194,19 @@ list_item_verbose(struct cpio *cpio, struct archive_en
 	else
 		fmt = cpio->day_first ? "%e %b %H:%M" : "%b %e %H:%M";
 #endif
-	strftime(date, sizeof(date), fmt, localtime(&mtime));
+#if defined(HAVE_LOCALTIME_R)
+	ltime = localtime_r(&mtime, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+	tmptime = mtime;
+	terr = _localtime64_s(&tmbuf, &tmptime);
+	if (terr)
+		ltime = NULL;
+	else
+		ltime = &tmbuf;
+#else
+	ltime = localtime(&mtime);
+#endif
+	strftime(date, sizeof(date), fmt, ltime);
 
 	fprintf(out, "%s%3d %-8s %-8s %8s %12s %s",
 	    archive_entry_strmode(entry),

Modified: head/contrib/libarchive/cpio/test/test_basic.c
==============================================================================
--- head/contrib/libarchive/cpio/test/test_basic.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/cpio/test/test_basic.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -33,15 +33,15 @@ verify_files(const char *msg)
 	 */
 
 	/* Regular file with 2 links. */
-	failure(msg);
+	failure("%s", msg);
 	assertIsReg("file", 0644);
-	failure(msg);
+	failure("%s", msg);
 	assertFileSize("file", 10);
-	failure(msg);
+	failure("%s", msg);
 	assertFileNLinks("file", 2);
 
 	/* Another name for the same file. */
-	failure(msg);
+	failure("%s", msg);
 	assertIsHardlink("linkfile", "file");
 
 	/* Symlink */
@@ -49,11 +49,11 @@ verify_files(const char *msg)
 		assertIsSymlink("symlink", "file", 0);
 
 	/* Another file with 1 link and different permissions. */
-	failure(msg);
+	failure("%s", msg);
 	assertIsReg("file2", 0777);
-	failure(msg);
+	failure("%s", msg);
 	assertFileSize("file2", 10);
-	failure(msg);
+	failure("%s", msg);
 	assertFileNLinks("file2", 1);
 
 	/* dir */

Modified: head/contrib/libarchive/cpio/test/test_format_newc.c
==============================================================================
--- head/contrib/libarchive/cpio/test/test_format_newc.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/cpio/test/test_format_newc.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -205,9 +205,11 @@ DEFINE_TEST(test_format_newc)
 	gid = from_hex(e + 30, 8); /* gid */
 	assertEqualMem(e + 38, "00000003", 8); /* nlink */
 	t = from_hex(e + 46, 8); /* mtime */
-	failure("t=0x%08x now=0x%08x=%d", t, now, now);
+	failure("t=%#08jx now=%#08jx=%jd", (intmax_t)t, (intmax_t)now,
+	    (intmax_t)now);
 	assert(t <= now); /* File wasn't created in future. */
-	failure("t=0x%08x now - 2=0x%08x = %d", t, now - 2, now - 2);
+	failure("t=%#08jx now - 2=%#08jx=%jd", (intmax_t)t, (intmax_t)now - 2,
+	    (intmax_t)now - 2);
 	assert(t >= now - 2); /* File was created w/in last 2 secs. */
 	failure("newc format stores body only with last appearance of a link\n"
 	    "       first appearance should be empty, so this file size\n"
@@ -243,7 +245,8 @@ DEFINE_TEST(test_format_newc)
 		assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
 		assertEqualMem(e + 38, "00000001", 8); /* nlink */
 		t2 = from_hex(e + 46, 8); /* mtime */
-		failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+		failure("First entry created at t=%#08jx this entry created"
+		    " at t2=%#08jx", (intmax_t)t, (intmax_t)t2);
 		assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
 		assertEqualMem(e + 54, "00000005", 8); /* File size */
 		fs = from_hex(e + 54, 8);
@@ -278,7 +281,8 @@ DEFINE_TEST(test_format_newc)
 	assertEqualInt(nlinks("dir"), from_hex(e + 38, 8)); /* nlinks */
 #endif
 	t2 = from_hex(e + 46, 8); /* mtime */
-	failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+	failure("First entry created at t=%#08jx this entry created at"
+	    "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
 	assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
 	assertEqualMem(e + 54, "00000000", 8); /* File size */
 	fs = from_hex(e + 54, 8);
@@ -311,7 +315,8 @@ DEFINE_TEST(test_format_newc)
 	assertEqualInt(gid, from_hex(e + 30, 8)); /* gid */
 	assertEqualMem(e + 38, "00000003", 8); /* nlink */
 	t2 = from_hex(e + 46, 8); /* mtime */
-	failure("First entry created at t=0x%08x this entry created at t2=0x%08x", t, t2);
+	failure("First entry created at t=%#08jx this entry created at"
+	    "t2=%#08jx", (intmax_t)t, (intmax_t)t2);
 	assert(t2 == t || t2 == t + 1); /* Almost same as first entry. */
 	assertEqualInt(10, from_hex(e + 54, 8)); /* File size */
 	fs = from_hex(e + 54, 8);

Modified: head/contrib/libarchive/libarchive/archive.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -36,7 +36,7 @@
  * assert that ARCHIVE_VERSION_NUMBER >= 2012108.
  */
 /* Note: Compiler will complain if this does not match archive_entry.h! */
-#define	ARCHIVE_VERSION_NUMBER 3004001
+#define	ARCHIVE_VERSION_NUMBER 3004002
 
 #include <sys/stat.h>
 #include <stddef.h>  /* for wchar_t */
@@ -155,7 +155,7 @@ __LA_DECL int		archive_version_number(void);
 /*
  * Textual name/version of the library, useful for version displays.
  */
-#define	ARCHIVE_VERSION_ONLY_STRING "3.4.1"
+#define	ARCHIVE_VERSION_ONLY_STRING "3.4.2"
 #define	ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING
 __LA_DECL const char *	archive_version_string(void);
 
@@ -693,6 +693,8 @@ __LA_DECL int archive_read_set_passphrase_callback(str
 #define ARCHIVE_EXTRACT_SECURE_NOABSOLUTEPATHS (0x10000)
 /* Default: Do not clear no-change flags when unlinking object */
 #define	ARCHIVE_EXTRACT_CLEAR_NOCHANGE_FFLAGS	(0x20000)
+/* Default: Do not extract atomically (using rename) */
+#define	ARCHIVE_EXTRACT_SAFE_WRITES		(0x40000)
 
 __LA_DECL int archive_read_extract(struct archive *, struct archive_entry *,
 		     int flags);

Modified: head/contrib/libarchive/libarchive/archive_acl_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_acl_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_acl_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -25,12 +25,12 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_ACL_PRIVATE_H_INCLUDED
+#define ARCHIVE_ACL_PRIVATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_ACL_PRIVATE_H_INCLUDED
-#define	ARCHIVE_ACL_PRIVATE_H_INCLUDED
 
 #include "archive_string.h"
 

Modified: head/contrib/libarchive/libarchive/archive_blake2.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_blake2.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_blake2.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -12,8 +12,9 @@
    More information about the BLAKE2 hash function can be found at
    https://blake2.net.
 */
-#ifndef BLAKE2_H
-#define BLAKE2_H
+
+#ifndef ARCHIVE_BLAKE2_H
+#define ARCHIVE_BLAKE2_H
 
 #include <stddef.h>
 #include <stdint.h>

Modified: head/contrib/libarchive/libarchive/archive_blake2_impl.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_blake2_impl.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_blake2_impl.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -12,8 +12,9 @@
    More information about the BLAKE2 hash function can be found at
    https://blake2.net.
 */
-#ifndef BLAKE2_IMPL_H
-#define BLAKE2_IMPL_H
+
+#ifndef ARCHIVE_BLAKE2_IMPL_H
+#define ARCHIVE_BLAKE2_IMPL_H
 
 #include <stdint.h>
 #include <string.h>

Modified: head/contrib/libarchive/libarchive/archive_cmdline_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_cmdline_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_cmdline_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -25,14 +25,14 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_CMDLINE_PRIVATE_H
+#define ARCHIVE_CMDLINE_PRIVATE_H
+
 #ifndef __LIBARCHIVE_BUILD
 #ifndef __LIBARCHIVE_TEST
 #error This header is only to be used internally to libarchive.
 #endif
 #endif
-
-#ifndef ARCHIVE_CMDLINE_PRIVATE_H
-#define ARCHIVE_CMDLINE_PRIVATE_H
 
 struct archive_cmdline {
         char            *path;

Modified: head/contrib/libarchive/libarchive/archive_crc32.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_crc32.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_crc32.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -25,6 +25,9 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_CRC32_H
+#define ARCHIVE_CRC32_H
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
@@ -76,3 +79,5 @@ crc32(unsigned long crc, const void *_p, size_t len)
 		crc = crc_tbl[(crc ^ *p++) & 0xff] ^ (crc >> 8);
 	return (crc ^ 0xffffffffUL);
 }
+
+#endif

Modified: head/contrib/libarchive/libarchive/archive_cryptor_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_cryptor_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_cryptor_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -23,13 +23,12 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef __LIBARCHIVE_BUILD
-#error This header is only to be used internally to libarchive.
-#endif
-
 #ifndef ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED
 #define ARCHIVE_CRYPTOR_PRIVATE_H_INCLUDED
 
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
 /*
  * On systems that do not support any recognized crypto libraries,
  * the archive_cryptor.c file will normally define no usable symbols.

Modified: head/contrib/libarchive/libarchive/archive_digest_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_digest_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_digest_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -24,13 +24,12 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
+#ifndef ARCHIVE_DIGEST_PRIVATE_H_INCLUDED
+#define ARCHIVE_DIGEST_PRIVATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_CRYPTO_PRIVATE_H_INCLUDED
-#define ARCHIVE_CRYPTO_PRIVATE_H_INCLUDED
-
 /*
  * Crypto support in various Operating Systems:
  *

Modified: head/contrib/libarchive/libarchive/archive_endian.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_endian.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_endian.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -28,16 +28,15 @@
  * Borrowed from FreeBSD's <sys/endian.h>
  */
 
-#ifndef __LIBARCHIVE_BUILD
-#error This header is only to be used internally to libarchive.
-#endif
+#ifndef ARCHIVE_ENDIAN_H_INCLUDED
+#define ARCHIVE_ENDIAN_H_INCLUDED
 
 /* Note:  This is a purely internal header! */
 /* Do not use this outside of libarchive internal code! */
 
-#ifndef ARCHIVE_ENDIAN_H_INCLUDED
-#define ARCHIVE_ENDIAN_H_INCLUDED
-
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
 
 /*
  * Disabling inline keyword for compilers known to choke on it:

Modified: head/contrib/libarchive/libarchive/archive_entry.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_entry.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_entry.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -1699,7 +1699,7 @@ static const struct flag {
 	const wchar_t	*wname;
 	unsigned long	 set;
 	unsigned long	 clear;
-} flags[] = {
+} fileflags[] = {
 	/* Preferred (shorter) names per flag first, all prefixed by "no" */
 #ifdef SF_APPEND
 	{ "nosappnd",	L"nosappnd",		SF_APPEND,	0},
@@ -1876,7 +1876,7 @@ ae_fflagstostr(unsigned long bitset, unsigned long bit
 
 	bits = bitset | bitclear;
 	length = 0;
-	for (flag = flags; flag->name != NULL; flag++)
+	for (flag = fileflags; flag->name != NULL; flag++)
 		if (bits & (flag->set | flag->clear)) {
 			length += strlen(flag->name) + 1;
 			bits &= ~(flag->set | flag->clear);
@@ -1889,7 +1889,7 @@ ae_fflagstostr(unsigned long bitset, unsigned long bit
 		return (NULL);
 
 	dp = string;
-	for (flag = flags; flag->name != NULL; flag++) {
+	for (flag = fileflags; flag->name != NULL; flag++) {
 		if (bitset & flag->set || bitclear & flag->clear) {
 			sp = flag->name + 2;
 		} else if (bitset & flag->clear  ||  bitclear & flag->set) {
@@ -1941,7 +1941,7 @@ ae_strtofflags(const char *s, unsigned long *setp, uns
 		    *end != ' '  &&  *end != ',')
 			end++;
 		length = end - start;
-		for (flag = flags; flag->name != NULL; flag++) {
+		for (flag = fileflags; flag->name != NULL; flag++) {
 			size_t flag_length = strlen(flag->name);
 			if (length == flag_length
 			    && memcmp(start, flag->name, length) == 0) {
@@ -2009,7 +2009,7 @@ ae_wcstofflags(const wchar_t *s, unsigned long *setp, 
 		    *end != L' '  &&  *end != L',')
 			end++;
 		length = end - start;
-		for (flag = flags; flag->wname != NULL; flag++) {
+		for (flag = fileflags; flag->wname != NULL; flag++) {
 			size_t flag_length = wcslen(flag->wname);
 			if (length == flag_length
 			    && wmemcmp(start, flag->wname, length) == 0) {

Modified: head/contrib/libarchive/libarchive/archive_entry.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_entry.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_entry.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -30,7 +30,7 @@
 #define	ARCHIVE_ENTRY_H_INCLUDED
 
 /* Note: Compiler will complain if this does not match archive.h! */
-#define	ARCHIVE_VERSION_NUMBER 3004001
+#define	ARCHIVE_VERSION_NUMBER 3004002
 
 /*
  * Note: archive_entry.h is for use outside of libarchive; the

Modified: head/contrib/libarchive/libarchive/archive_entry_locale.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_entry_locale.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_entry_locale.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -25,12 +25,12 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_ENTRY_LOCALE_H_INCLUDED
+#define ARCHIVE_ENTRY_LOCALE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_ENTRY_LOCALE_H_INCLUDED
-#define	ARCHIVE_ENTRY_LOCALE_H_INCLUDED
 
 struct archive_entry;
 struct archive_string_conv;

Modified: head/contrib/libarchive/libarchive/archive_entry_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_entry_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_entry_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -25,12 +25,12 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
+#define ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
-#define	ARCHIVE_ENTRY_PRIVATE_H_INCLUDED
 
 #include "archive_acl_private.h"
 #include "archive_string.h"

Modified: head/contrib/libarchive/libarchive/archive_getdate.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_getdate.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_getdate.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -27,6 +27,7 @@
 **  This code is in the public domain and has no copyright.
 */
 
+#include "archive_platform.h"
 #ifdef __FreeBSD__
 #include <sys/cdefs.h>
 __FBSDID("$FreeBSD$");
@@ -694,8 +695,16 @@ Convert(time_t Month, time_t Day, time_t Year,
 	signed char DaysInMonth[12] = {
 		31, 0, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
 	};
-	time_t	Julian;
-	int	i;
+	time_t		Julian;
+	int		i;
+	struct tm	*ltime;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+	struct tm	tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+	errno_t		terr;
+	__time64_t	tmptime;
+#endif
 
 	if (Year < 69)
 		Year += 2000;
@@ -722,21 +731,64 @@ Convert(time_t Month, time_t Day, time_t Year,
 	Julian *= DAY;
 	Julian += Timezone;
 	Julian += Hours * HOUR + Minutes * MINUTE + Seconds;
+#if defined(HAVE_LOCALTIME_R)
+	ltime = localtime_r(&Julian, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+	tmptime = Julian;
+	terr = _localtime64_s(&tmbuf, &tmptime);
+	if (terr)
+		ltime = NULL;
+	else
+		ltime = &tmbuf;
+#else
+	ltime = localtime(&Julian);
+#endif
 	if (DSTmode == DSTon
-	    || (DSTmode == DSTmaybe && localtime(&Julian)->tm_isdst))
+	    || (DSTmode == DSTmaybe && ltime->tm_isdst))
 		Julian -= HOUR;
 	return Julian;
 }
 
-
 static time_t
 DSTcorrect(time_t Start, time_t Future)
 {
-	time_t	StartDay;
-	time_t	FutureDay;
+	time_t		StartDay;
+	time_t		FutureDay;
+	struct tm	*ltime;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+	struct tm	tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+	errno_t		terr;
+	__time64_t	tmptime;
+#endif
 
-	StartDay = (localtime(&Start)->tm_hour + 1) % 24;
-	FutureDay = (localtime(&Future)->tm_hour + 1) % 24;
+#if defined(HAVE_LOCALTIME_R)
+	ltime = localtime_r(&Start, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+	tmptime = Start;
+	terr = _localtime64_s(&tmbuf, &tmptime);
+	if (terr)
+		ltime = NULL;
+	else
+		ltime = &tmbuf;
+#else
+	ltime = localtime(&Start);
+#endif
+	StartDay = (ltime->tm_hour + 1) % 24;
+#if defined(HAVE_LOCALTIME_R)
+	ltime = localtime_r(&Future, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+	tmptime = Future;
+	terr = _localtime64_s(&tmbuf, &tmptime);
+	if (terr)
+		ltime = NULL;
+	else
+		ltime = &tmbuf;
+#else
+	ltime = localtime(&Future);
+#endif
+	FutureDay = (ltime->tm_hour + 1) % 24;
 	return (Future - Start) + (StartDay - FutureDay) * HOUR;
 }
 
@@ -747,9 +799,27 @@ RelativeDate(time_t Start, time_t zone, int dstmode,
 {
 	struct tm	*tm;
 	time_t	t, now;
+#if defined(HAVE_GMTIME_R) || defined(HAVE__GMTIME64_S)
+	struct tm	tmbuf;
+#endif
+#if defined(HAVE__GMTIME64_S)
+	errno_t		terr;
+	__time64_t	tmptime;
+#endif
 
 	t = Start - zone;
+#if defined(HAVE_GMTIME_R)
+	tm = gmtime_r(&t, &tmbuf);
+#elif defined(HAVE__GMTIME64_S)
+	tmptime = t;
+	terr = _gmtime64_s(&tmbuf, &tmptime);
+	if (terr)
+		tm = NULL;
+	else
+		tm = &tmbuf;
+#else
 	tm = gmtime(&t);
+#endif
 	now = Start;
 	now += DAY * ((DayNumber - tm->tm_wday + 7) % 7);
 	now += 7 * DAY * (DayOrdinal <= 0 ? DayOrdinal : DayOrdinal - 1);
@@ -765,10 +835,28 @@ RelativeMonth(time_t Start, time_t Timezone, time_t Re
 	struct tm	*tm;
 	time_t	Month;
 	time_t	Year;
+#if defined(HAVE_LOCALTIME_R) || defined(HAVE__LOCALTIME64_S)
+	struct tm	tmbuf;
+#endif
+#if defined(HAVE__LOCALTIME64_S)
+	errno_t		terr;
+	__time64_t	tmptime;
+#endif
 
 	if (RelMonth == 0)
 		return 0;
+#if defined(HAVE_LOCALTIME_R)
+	tm = localtime_r(&Start, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+	tmptime = Start;
+	terr = _localtime64_s(&tmbuf, &tmptime);
+	if (terr)
+		tm = NULL;
+	else
+		tm = &tmbuf;
+#else
 	tm = localtime(&Start);
+#endif
 	Month = 12 * (tm->tm_year + 1900) + tm->tm_mon + RelMonth;
 	Year = Month / 12;
 	Month = Month % 12 + 1;
@@ -905,6 +993,10 @@ __archive_get_date(time_t now, const char *p)
 	time_t		Start;
 	time_t		tod;
 	long		tzone;
+#if defined(HAVE__LOCALTIME64_S) || defined(HAVE__GMTIME64_S)
+	errno_t		terr;
+	__time64_t	tmptime;
+#endif
 
 	/* Clear out the parsed token array. */
 	memset(tokens, 0, sizeof(tokens));
@@ -913,20 +1005,44 @@ __archive_get_date(time_t now, const char *p)
 	gds = &_gds;
 
 	/* Look up the current time. */
+#if defined(HAVE_LOCALTIME_R)
+	tm = localtime_r(&now, &local);
+#elif defined(HAVE__LOCALTIME64_S)
+	tmptime = now;
+	terr = _localtime64_s(&local, &tmptime);
+	if (terr)
+		tm = NULL;
+	else
+		tm = &local;
+#else
 	memset(&local, 0, sizeof(local));
-	tm = localtime (&now);
+	tm = localtime(&now);
+#endif
 	if (tm == NULL)
 		return -1;
+#if !defined(HAVE_LOCALTIME_R) && !defined(HAVE__LOCALTIME64_S)
 	local = *tm;
+#endif
 
 	/* Look up UTC if we can and use that to determine the current
 	 * timezone offset. */
+#if defined(HAVE_GMTIME_R)
+	gmt_ptr = gmtime_r(&now, &gmt);
+#elif defined(HAVE__GMTIME64_S)
+	tmptime = now;
+	terr = _gmtime64_s(&gmt, &tmptime);
+	if (terr)
+		gmt_ptr = NULL;
+	else
+		gmt_ptr = &gmt;
+#else
 	memset(&gmt, 0, sizeof(gmt));
-	gmt_ptr = gmtime (&now);
+	gmt_ptr = gmtime(&now);
 	if (gmt_ptr != NULL) {
 		/* Copy, in case localtime and gmtime use the same buffer. */
 		gmt = *gmt_ptr;
 	}
+#endif
 	if (gmt_ptr != NULL)
 		tzone = difftm (&gmt, &local);
 	else
@@ -960,7 +1076,18 @@ __archive_get_date(time_t now, const char *p)
 	 * time components instead of the local timezone. */
 	if (gds->HaveZone && gmt_ptr != NULL) {
 		now -= gds->Timezone;
-		gmt_ptr = gmtime (&now);
+#if defined(HAVE_GMTIME_R)
+		gmt_ptr = gmtime_r(&now, &gmt);
+#elif defined(HAVE__GMTIME64_S)
+		tmptime = now;
+		terr = _gmtime64_s(&gmt, &tmptime);
+		if (terr)
+			gmt_ptr = NULL;
+		else
+			gmt_ptr = &gmt;
+#else
+		gmt_ptr = gmtime(&now);
+#endif
 		if (gmt_ptr != NULL)
 			local = *gmt_ptr;
 		now += gds->Timezone;

Modified: head/contrib/libarchive/libarchive/archive_getdate.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_getdate.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_getdate.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -25,12 +25,12 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_GETDATE_H_INCLUDED
+#define ARCHIVE_GETDATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_GETDATE_H_INCLUDED
-#define	ARCHIVE_GETDATE_H_INCLUDED
 
 #include <time.h>
 

Modified: head/contrib/libarchive/libarchive/archive_hmac_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_hmac_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_hmac_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -23,13 +23,12 @@
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */
 
-#ifndef __LIBARCHIVE_BUILD
-#error This header is only to be used internally to libarchive.
-#endif
-
 #ifndef ARCHIVE_HMAC_PRIVATE_H_INCLUDED
 #define ARCHIVE_HMAC_PRIVATE_H_INCLUDED
 
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
 /*
  * On systems that do not support any recognized crypto libraries,
  * the archive_hmac.c file is expected to define no usable symbols.

Modified: head/contrib/libarchive/libarchive/archive_openssl_evp_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_openssl_evp_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_openssl_evp_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -22,8 +22,13 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #ifndef ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
 #define ARCHIVE_OPENSSL_EVP_PRIVATE_H_INCLUDED
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
 
 #include <openssl/evp.h>
 #include <openssl/opensslv.h>

Modified: head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_openssl_hmac_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -22,8 +22,13 @@
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #ifndef ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
 #define ARCHIVE_OPENSSL_HMAC_PRIVATE_H_INCLUDED
+
+#ifndef __LIBARCHIVE_BUILD
+#error This header is only to be used internally to libarchive.
+#endif
 
 #include <openssl/hmac.h>
 #include <openssl/opensslv.h>

Modified: head/contrib/libarchive/libarchive/archive_options_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_options_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_options_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -23,6 +23,9 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED
+#define ARCHIVE_OPTIONS_PRIVATE_H_INCLUDED
+
 #include "archive_platform.h"
 __FBSDID("$FreeBSD$");
 
@@ -45,3 +48,4 @@ _archive_set_either_option(struct archive *a,
     const char *m, const char *o, const char *v,
     option_handler use_format_option, option_handler use_filter_option);
 
+#endif

Modified: head/contrib/libarchive/libarchive/archive_pack_dev.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_pack_dev.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_pack_dev.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -57,11 +57,12 @@ __RCSID("$NetBSD$");
 #ifdef HAVE_SYS_STAT_H
 #include <sys/stat.h>
 #endif
-#ifdef HAVE_SYS_SYSMACROS_H
-#include <sys/sysmacros.h>
-#endif
-#ifdef HAVE_SYS_MKDEV_H
+#if MAJOR_IN_MKDEV
 #include <sys/mkdev.h>
+#define HAVE_MAJOR
+#elif MAJOR_IN_SYSMACROS
+#include <sys/sysmacros.h>
+#define HAVE_MAJOR
 #endif
 #ifdef HAVE_UNISTD_H
 #include <unistd.h>

Modified: head/contrib/libarchive/libarchive/archive_pack_dev.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_pack_dev.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_pack_dev.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -31,8 +31,8 @@
 
 /* Originally from NetBSD's mknod(8) source. */
 
-#ifndef	_PACK_DEV_H
-#define	_PACK_DEV_H
+#ifndef	ARCHIVE_PACK_DEV_H
+#define	ARCHIVE_PACK_DEV_H
 
 typedef	dev_t pack_t(int, unsigned long [], const char **);
 
@@ -46,4 +46,4 @@ pack_t	 pack_native;
 					 (((y) << 12) & 0xfff00000) | \
 					 (((y) <<  0) & 0x000000ff)))
 
-#endif	/* _PACK_DEV_H */
+#endif	/* ARCHIVE_PACK_DEV_H */

Modified: head/contrib/libarchive/libarchive/archive_pathmatch.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_pathmatch.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_pathmatch.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -26,14 +26,14 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_PATHMATCH_H
+#define ARCHIVE_PATHMATCH_H
+
 #ifndef __LIBARCHIVE_BUILD
 #ifndef __LIBARCHIVE_TEST
 #error This header is only to be used internally to libarchive.
 #endif
 #endif
-
-#ifndef ARCHIVE_PATHMATCH_H
-#define ARCHIVE_PATHMATCH_H
 
 /* Don't anchor at beginning unless the pattern starts with "^" */
 #define PATHMATCH_NO_ANCHOR_START	1

Modified: head/contrib/libarchive/libarchive/archive_platform_acl.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_platform_acl.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_platform_acl.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -30,6 +30,12 @@
 #ifndef ARCHIVE_PLATFORM_ACL_H_INCLUDED
 #define ARCHIVE_PLATFORM_ACL_H_INCLUDED
 
+#ifndef __LIBARCHIVE_BUILD
+#ifndef __LIBARCHIVE_TEST_COMMON
+#error This header is only to be used internally to libarchive.
+#endif
+#endif
+
 /*
  * Determine what ACL types are supported
  */

Modified: head/contrib/libarchive/libarchive/archive_platform_xattr.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_platform_xattr.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_platform_xattr.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -30,6 +30,12 @@
 #ifndef ARCHIVE_PLATFORM_XATTR_H_INCLUDED
 #define ARCHIVE_PLATFORM_XATTR_H_INCLUDED
 
+#ifndef __LIBARCHIVE_BUILD
+#ifndef __LIBARCHIVE_TEST_COMMON
+#error This header is only to be used internally to libarchive.
+#endif
+#endif
+
 /*
  * Determine if we support extended attributes
  */

Modified: head/contrib/libarchive/libarchive/archive_ppmd7.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_ppmd7.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_ppmd7.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -1000,7 +1000,7 @@ static void RangeEnc_ShiftLow(CPpmd7z_RangeEnc *p)
 
 static void RangeEnc_Encode(CPpmd7z_RangeEnc *p, UInt32 start, UInt32 size, UInt32 total)
 {
-  p->Low += start * (p->Range /= total);
+  p->Low += (UInt64)start * (UInt64)(p->Range /= total);
   p->Range *= size;
   while (p->Range < kTopValue)
   {

Modified: head/contrib/libarchive/libarchive/archive_ppmd7_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_ppmd7_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_ppmd7_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -6,12 +6,12 @@ This code is based on PPMd var.H (2001): Dmitry Shkari
 of RangeCoder from 7z, instead of RangeCoder from original PPMd var.H.
 If you need the compatibility with original PPMd var.H, you can use external RangeDecoder */
 
+#ifndef ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
+#define ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
-#define ARCHIVE_PPMD7_PRIVATE_H_INCLUDED
 
 #include "archive_ppmd_private.h"
 

Modified: head/contrib/libarchive/libarchive/archive_ppmd8_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_ppmd8_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_ppmd8_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -4,8 +4,8 @@ This code is based on:
   PPMd var.I (2002): Dmitry Shkarin : Public domain
   Carryless rangecoder (1999): Dmitry Subbotin : Public domain */
 
-#ifndef __PPMD8_H
-#define __PPMD8_H
+#ifndef ARCHIVE_PPMD8_PRIVATE_H_INCLUDED
+#define ARCHIVE_PPMD8_PRIVATE_H_INCLUDED
 
 #include "archive_ppmd_private.h"
 

Modified: head/contrib/libarchive/libarchive/archive_ppmd_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_ppmd_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_ppmd_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -2,12 +2,12 @@
 2010-03-12 : Igor Pavlov : Public domain
 This code is based on PPMd var.H (2001): Dmitry Shkarin : Public domain */
 
+#ifndef ARCHIVE_PPMD_PRIVATE_H_INCLUDED
+#define ARCHIVE_PPMD_PRIVATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_PPMD_PRIVATE_H_INCLUDED
-#define ARCHIVE_PPMD_PRIVATE_H_INCLUDED
 
 #include <stddef.h>
 

Modified: head/contrib/libarchive/libarchive/archive_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -25,13 +25,13 @@
  * $FreeBSD$
  */
 
+#ifndef ARCHIVE_PRIVATE_H_INCLUDED
+#define ARCHIVE_PRIVATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
 
-#ifndef ARCHIVE_PRIVATE_H_INCLUDED
-#define	ARCHIVE_PRIVATE_H_INCLUDED
-
 #if HAVE_ICONV_H
 #include <iconv.h>
 #endif
@@ -153,6 +153,11 @@ void	__archive_errx(int retvalue, const char *msg) __L
 
 void	__archive_ensure_cloexec_flag(int fd);
 int	__archive_mktemp(const char *tmpdir);
+#if defined(_WIN32) && !defined(__CYGWIN__)
+int	__archive_mkstemp(wchar_t *template);
+#else
+int	__archive_mkstemp(char *template);
+#endif
 
 int	__archive_clean(struct archive *);
 

Modified: head/contrib/libarchive/libarchive/archive_random_private.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_random_private.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_random_private.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -23,12 +23,12 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifndef ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
+#define ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
+
 #ifndef __LIBARCHIVE_BUILD
 #error This header is only to be used internally to libarchive.
 #endif
-
-#ifndef ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
-#define ARCHIVE_RANDOM_PRIVATE_H_INCLUDED
 
 /* Random number generator. */
 int archive_random(void *buf, size_t nbytes);

Modified: head/contrib/libarchive/libarchive/archive_rb.h
==============================================================================
--- head/contrib/libarchive/libarchive/archive_rb.h	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_rb.h	Wed Feb 12 00:16:56 2020	(r357785)
@@ -28,9 +28,10 @@
  *
  * Based on NetBSD: rb.h,v 1.13 2009/08/16 10:57:01 yamt Exp
  */
-#ifndef ARCHIVE_RB_H_
-#define	ARCHIVE_RB_H_
 
+#ifndef ARCHIVE_RB_H_INCLUDED
+#define	ARCHIVE_RB_H_INCLUDED
+
 struct archive_rb_node {
 	struct archive_rb_node *rb_nodes[2];
 	/*
@@ -48,12 +49,24 @@ struct archive_rb_node {
     __archive_rb_tree_iterate((T), NULL, ARCHIVE_RB_DIR_LEFT)
 #define ARCHIVE_RB_TREE_MAX(T) \
     __archive_rb_tree_iterate((T), NULL, ARCHIVE_RB_DIR_RIGHT)
+#define ARCHIVE_RB_TREE_NEXT(T, N) \
+    __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_RIGHT)
+#define ARCHIVE_RB_TREE_PREV(T, N) \
+    __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_LEFT)
 #define ARCHIVE_RB_TREE_FOREACH(N, T) \
     for ((N) = ARCHIVE_RB_TREE_MIN(T); (N); \
-	(N) = __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_RIGHT))
+	(N) = ARCHIVE_RB_TREE_NEXT((T), (N)))
 #define ARCHIVE_RB_TREE_FOREACH_REVERSE(N, T) \
     for ((N) = ARCHIVE_RB_TREE_MAX(T); (N); \
-	(N) = __archive_rb_tree_iterate((T), (N), ARCHIVE_RB_DIR_LEFT))
+	(N) = ARCHIVE_RB_TREE_PREV((T), (N)))
+#define ARCHIVE_RB_TREE_FOREACH_SAFE(N, T, S) \
+    for ((N) = ARCHIVE_RB_TREE_MIN(T); \
+	(N) && ((S) = ARCHIVE_RB_TREE_NEXT((T), (N)), 1); \
+	(N) = (S))
+#define ARCHIVE_RB_TREE_FOREACH_REVERSE_SAFE(N, T, S) \
+    for ((N) = ARCHIVE_RB_TREE_MAX(T); \
+        (N) && ((S) = ARCHIVE_RB_TREE_PREV((T), (N)), 1); \
+        (N) = (S))
 
 /*
  * archive_rbto_compare_nodes_fn:

Modified: head/contrib/libarchive/libarchive/archive_read.c
==============================================================================
--- head/contrib/libarchive/libarchive/archive_read.c	Tue Feb 11 23:49:55 2020	(r357784)
+++ head/contrib/libarchive/libarchive/archive_read.c	Wed Feb 12 00:16:56 2020	(r357785)
@@ -433,7 +433,7 @@ archive_read_add_callback_data(struct archive *_a, voi
 		return ARCHIVE_FATAL;
 	}
 	a->client.dataset = (struct archive_read_data_node *)p;
-	for (i = a->client.nodes - 1; i > iindex && i > 0; i--) {

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***


More information about the svn-src-all mailing list