X Tutup
Skip to content

Commit 329c542

Browse files
committed
update-done: ignore nanosecond file timestamp components, they are not reliable
https://bugs.freedesktop.org/show_bug.cgi?id=90192
1 parent 0a2f908 commit 329c542

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/update-done/update-done.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,15 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
3838
assert(ts);
3939

4040
if (stat(path, &st) >= 0) {
41-
/* Is the timestamp file already newer than the OS? If so, there's nothing to do. */
42-
if (st.st_mtim.tv_sec > ts->tv_sec ||
43-
(st.st_mtim.tv_sec == ts->tv_sec && st.st_mtim.tv_nsec >= ts->tv_nsec))
41+
/* Is the timestamp file already newer than the OS? If
42+
* so, there's nothing to do. We ignore the nanosecond
43+
* component of the timestamp, since some file systems
44+
* do not support any better accuracy than 1s and we
45+
* have no way to identify the accuracy
46+
* available. Most notably ext4 on small disks (where
47+
* 128 byte inodes are used) does not support better
48+
* accuracy than 1s. */
49+
if (st.st_mtim.tv_sec > ts->tv_sec)
4450
return 0;
4551

4652
/* It is older? Then let's update it */

0 commit comments

Comments
 (0)
X Tutup