aboutsummaryrefslogtreecommitdiffstats
path: root/libarchive/archive_write_set_format_zip.c
diff options
context:
space:
mode:
authorMartin Matuska <mm@FreeBSD.org>2020-02-11 23:48:03 +0000
committerMartin Matuska <mm@FreeBSD.org>2020-02-11 23:48:03 +0000
commit8185c4ae244f9a52ad987b36e7d6300500054d00 (patch)
tree11e2d7cd0caf20998ed1e1146e1c1d7fc747165e /libarchive/archive_write_set_format_zip.c
parent98c1f51f769841d99d879099f9075ff60d51ee4a (diff)
downloadsrc-8185c4ae244f9a52ad987b36e7d6300500054d00.tar.gz
src-8185c4ae244f9a52ad987b36e7d6300500054d00.zip
Update vendor/libarchive/dist to git 3288ebb0353beb51dfb09d444dedbe9235ead53dvendor/libarchive/3.4.2
Libarchive 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()
Notes
Notes: svn path=/vendor/libarchive/dist/; revision=357783 svn path=/vendor/libarchive/3.4.2/; revision=357784; tag=vendor/libarchive/3.4.2
Diffstat (limited to 'libarchive/archive_write_set_format_zip.c')
-rw-r--r--libarchive/archive_write_set_format_zip.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/libarchive/archive_write_set_format_zip.c b/libarchive/archive_write_set_format_zip.c
index f28a8c3a341f..6d485295d50f 100644
--- a/libarchive/archive_write_set_format_zip.c
+++ b/libarchive/archive_write_set_format_zip.c
@@ -57,6 +57,7 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_write_set_format_zip.c 201168 20
#include "archive_private.h"
#include "archive_random_private.h"
#include "archive_write_private.h"
+#include "archive_write_set_format_private.h"
#ifndef HAVE_ZLIB_H
#include "archive_crc32.h"
@@ -526,8 +527,8 @@ archive_write_zip_header(struct archive_write *a, struct archive_entry *entry)
/* Ignore types of entries that we don't support. */
type = archive_entry_filetype(entry);
if (type != AE_IFREG && type != AE_IFDIR && type != AE_IFLNK) {
- archive_set_error(&a->archive, ARCHIVE_ERRNO_MISC,
- "Filetype not supported");
+ __archive_write_entry_filetype_unsupported(
+ &a->archive, entry, "zip");
return ARCHIVE_FAILED;
};
@@ -1372,10 +1373,28 @@ dos_time(const time_t unix_time)
{
struct tm *t;
unsigned int dt;
+#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
/* This will not preserve time when creating/extracting the archive
* on two systems with different time zones. */
+#if defined(HAVE_LOCALTIME_R)
+ t = localtime_r(&unix_time, &tmbuf);
+#elif defined(HAVE__LOCALTIME64_S)
+ tmptime = unix_time;
+ terr = _localtime64_s(&tmbuf, &tmptime);
+ if (terr)
+ t = NULL;
+ else
+ t = &tmbuf;
+#else
t = localtime(&unix_time);
+#endif
/* MSDOS-style date/time is only between 1980-01-01 and 2107-12-31 */
if (t->tm_year < 1980 - 1900)