1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
https://lore.kernel.org/linux-xfs/20240205232343.2162947-1-sam@gentoo.org/
From 37495c1600002551badb5eb16ff244b0c5ffd3b0 Mon Sep 17 00:00:00 2001
From: Sam James <sam@gentoo.org>
Date: Fri, 15 Dec 2023 00:40:26 +0000
Subject: [PATCH 2/3] io: Adapt to >= 64-bit time_t
We now require (at least) 64-bit time_t, so we need to adjust some printf
specifiers accordingly.
Unfortunately, we've stumbled upon a ridiculous C mmoment whereby there's
no neat format specifier (not even one of the inttypes ones) for time_t, so
we cast to intmax_t and use %jd.
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Sam James <sam@gentoo.org>
--- a/io/stat.c
+++ b/io/stat.c
@@ -66,11 +66,11 @@ dump_raw_stat(struct stat *st)
printf("stat.ino = %llu\n", (unsigned long long)st->st_ino);
printf("stat.size = %lld\n", (long long)st->st_size);
printf("stat.blocks = %lld\n", (long long)st->st_blocks);
- printf("stat.atime.tv_sec = %ld\n", st->st_atim.tv_sec);
+ printf("stat.atime.tv_sec = %jd\n", (intmax_t)st->st_atim.tv_sec);
printf("stat.atime.tv_nsec = %ld\n", st->st_atim.tv_nsec);
- printf("stat.ctime.tv_sec = %ld\n", st->st_ctim.tv_sec);
+ printf("stat.ctime.tv_sec = %jd\n", (intmax_t)st->st_ctim.tv_sec);
printf("stat.ctime.tv_nsec = %ld\n", st->st_ctim.tv_nsec);
- printf("stat.mtime.tv_sec = %ld\n", st->st_mtim.tv_sec);
+ printf("stat.mtime.tv_sec = %jd\n", (intmax_t)st->st_mtim.tv_sec);
printf("stat.mtime.tv_nsec = %ld\n", st->st_mtim.tv_nsec);
printf("stat.rdev_major = %u\n", major(st->st_rdev));
printf("stat.rdev_minor = %u\n", minor(st->st_rdev));
--
2.43.0
|