From: Tim Kientzle Date: Sun, 18 Apr 2010 05:36:35 +0000 (-0400) Subject: Don't set atime and ctime unless the header actually specifies them. X-Git-Tag: v3.0.0a~1099 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=36b755d56da06d06e6a8098d045517c508f22431;p=thirdparty%2Flibarchive.git Don't set atime and ctime unless the header actually specifies them. SVN-Revision: 2263 --- diff --git a/libarchive/archive_read_support_format_tar.c b/libarchive/archive_read_support_format_tar.c index 157a7fd4e..5719a43d5 100644 --- a/libarchive/archive_read_support_format_tar.c +++ b/libarchive/archive_read_support_format_tar.c @@ -1684,6 +1684,7 @@ header_gnutar(struct archive_read *a, struct tar *tar, struct archive_entry *entry, const void *h) { const struct archive_entry_header_gnutar *header; + int64_t t; (void)a; @@ -1726,10 +1727,13 @@ header_gnutar(struct archive_read *a, struct tar *tar, tar->entry_padding = 0x1ff & (-tar->entry_bytes_remaining); /* Grab GNU-specific fields. */ - archive_entry_set_atime(entry, - tar_atol(header->atime, sizeof(header->atime)), 0); - archive_entry_set_ctime(entry, - tar_atol(header->ctime, sizeof(header->ctime)), 0); + t = tar_atol(header->atime, sizeof(header->atime)); + if (t > 0) + archive_entry_set_atime(entry, t, 0); + t = tar_atol(header->ctime, sizeof(header->ctime)); + if (t > 0) + archive_entry_set_ctime(entry, t, 0); + if (header->realsize[0] != 0) { tar->realsize = tar_atol(header->realsize, sizeof(header->realsize));