You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

39 lines
1.7 KiB

From 6503fbef433da29fe1f450e44c8eaca61888bcda Mon Sep 17 00:00:00 2001
From: Lennart Poettering <lennart@poettering.net>
Date: Mon, 27 Apr 2015 17:25:57 +0200
Subject: [PATCH] update-done: ignore nanosecond file timestamp components,
they are not reliable
https://bugs.freedesktop.org/show_bug.cgi?id=90192
(cherry picked from commit 329c542585cd92cb905990e3bf59eda16fd88cfb)
Cherry-picked from: a38a3e0
Resolves: #1222517
---
src/update-done/update-done.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/src/update-done/update-done.c b/src/update-done/update-done.c
index 561963e5e..cb5cd6f4a 100644
--- a/src/update-done/update-done.c
+++ b/src/update-done/update-done.c
@@ -36,9 +36,15 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
assert(ts);
if (stat(path, &st) >= 0) {
- /* Is the timestamp file already newer than the OS? If so, there's nothing to do. */
- if (st.st_mtim.tv_sec > ts->tv_sec ||
- (st.st_mtim.tv_sec == ts->tv_sec && st.st_mtim.tv_nsec >= ts->tv_nsec))
+ /* Is the timestamp file already newer than the OS? If
+ * so, there's nothing to do. We ignore the nanosecond
+ * component of the timestamp, since some file systems
+ * do not support any better accuracy than 1s and we
+ * have no way to identify the accuracy
+ * available. Most notably ext4 on small disks (where
+ * 128 byte inodes are used) does not support better
+ * accuracy than 1s. */
+ if (st.st_mtim.tv_sec > ts->tv_sec)
return 0;
/* It is older? Then let's update it */