summaryrefslogtreecommitdiff
path: root/tests/tar_xattr_schily.c
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-24 13:36:50 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2019-07-24 18:10:34 +0200
commit4fdfd1f62a9d50298b0bb71e8bea04174af4a3ab (patch)
treed511b488ce77ef2b0b84b26ead69a1d01375491c /tests/tar_xattr_schily.c
parent30fbd496a1793b4374873144432f9b7a996a689d (diff)
Fix processing of tar mtime on 32 bit systems
struct stat uses time_t to store time values. On some 32 bit systems, this may be a 32 bit integer. This patch adds a broken-out 64 bit time value to tar_header_decoded_t and makes sure to clamp the value to +/- (2^32 - 1) if required when writing it back to a struct stat. Reported-by: Matt Turner <mattst88@gmail.com> Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at>
Diffstat (limited to 'tests/tar_xattr_schily.c')
-rw-r--r--tests/tar_xattr_schily.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tests/tar_xattr_schily.c b/tests/tar_xattr_schily.c
index e49bdd9..9030a45 100644
--- a/tests/tar_xattr_schily.c
+++ b/tests/tar_xattr_schily.c
@@ -43,6 +43,7 @@ int main(void)
assert(hdr.sb.st_gid == 01750);
assert(hdr.sb.st_size == 5);
assert(hdr.sb.st_mtime == 1543094477);
+ assert(hdr.mtime == 1543094477);
assert(strcmp(hdr.name, "input.txt") == 0);
assert(!hdr.unknown_record);
assert(read_data("data0", fd, buffer, 5) == 0);