]> granicus.if.org Git - strace/commitdiff
tests/xstatx.c: fix stat syscall tests on mips64
authorJames Cowgill <james410@cowgill.org.uk>
Thu, 11 Aug 2016 16:33:01 +0000 (16:33 +0000)
committerDmitry V. Levin <ldv@altlinux.org>
Thu, 11 Aug 2016 16:45:23 +0000 (16:45 +0000)
For historical reasons the kernel struct stat represents times as unsigned
32-bit integers on mips64. Therefore, while it's possible to give a file a
timestamp before 1970 with futimens, reading the same timestamp through
struct stat will give a positive time (around 2106).
Workaround by using positive timestamps for testing on mips64.

* tests/xstatx.c (create_sample): Use positive timestamps on mips64.

tests/xstatx.c

index 2883f167b874f89f9fe7a2595a8ebc9f0fd6ac33..a9fb8e8a5e8e49a7688d27b717a6d5a8e72045e5 100644 (file)
@@ -211,7 +211,12 @@ static int
 create_sample(const char *fname, const libc_off_t size)
 {
        static const struct timespec ts[] = {
+#ifdef __mips64
+               // On mips64, struct stat cannot handle negative timestamps
+               {10841, 246}, {10843, 135}
+#else
                {-10843, 135}, {-10841, 246}
+#endif
        };
 
        (void) close(0);