]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
Don't set atime and ctime unless the header actually specifies them.
authorTim Kientzle <kientzle@gmail.com>
Sun, 18 Apr 2010 05:36:35 +0000 (01:36 -0400)
committerTim Kientzle <kientzle@gmail.com>
Sun, 18 Apr 2010 05:36:35 +0000 (01:36 -0400)
SVN-Revision: 2263

libarchive/archive_read_support_format_tar.c

index 157a7fd4e40cdfbc33b65629c5bd41e577ed9573..5719a43d51c2ad5e28cb6f7a08cca4db42c3f8cf 100644 (file)
@@ -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));