]> git.ipfire.org Git - thirdparty/libarchive.git/commitdiff
The ustar header for the 'x' entry in pax format can be simplified:
authorTim Kientzle <kientzle@gmail.com>
Fri, 13 Nov 2009 06:22:01 +0000 (01:22 -0500)
committerTim Kientzle <kientzle@gmail.com>
Fri, 13 Nov 2009 06:22:01 +0000 (01:22 -0500)
ustar headers can't support high-res mtime and don't support atime
at all.

Also, work around an annoying compiler warning pointed out by Bill Hoffman.

SVN-Revision: 1648

libarchive/archive_write_set_format_pax.c

index f12168b6bd1808677d1ea612c1422cc2d470ee1e..ae3b2b5aebdbb32799d1f42c5caf537d1072c0ab 100644 (file)
@@ -887,7 +887,6 @@ archive_write_pax_header(struct archive_write *a,
                uid_t uid;
                gid_t gid;
                mode_t mode;
-               long ns;
 
                pax_attr_entry = archive_entry_new();
                p = archive_entry_pathname(entry_main);
@@ -925,17 +924,12 @@ archive_write_pax_header(struct archive_write *a,
 
                /* Copy mtime, but clip to ustar limits. */
                s = archive_entry_mtime(entry_main);
-               ns = archive_entry_mtime_nsec(entry_main);
-               if (s < 0) { s = 0; ns = 0; }
-               if (s > 0x7fffffff) { s = 0x7fffffff; ns = 0; }
-               archive_entry_set_mtime(pax_attr_entry, s, ns);
-
-               /* Ditto for atime. */
-               s = archive_entry_atime(entry_main);
-               ns = archive_entry_atime_nsec(entry_main);
-               if (s < 0) { s = 0; ns = 0; }
-               if (s > 0x7fffffff) { s = 0x7fffffff; ns = 0; }
-               archive_entry_set_atime(pax_attr_entry, s, ns);
+               if (s < 0) { s = 0; }
+               if (s >= 0x7fffffff) { s = 0x7fffffff; }
+               archive_entry_set_mtime(pax_attr_entry, s, 0);
+
+               /* Standard ustar doesn't support atime. */
+               archive_entry_set_atime(pax_attr_entry, 0, 0);
 
                /* Standard ustar doesn't support ctime. */
                archive_entry_set_ctime(pax_attr_entry, 0, 0);