mirror of
https://github.com/systemd/systemd.git
synced 2024-12-26 03:22:00 +03:00
update-done: ignore nanosecond file timestamp components, they are not reliable
https://bugs.freedesktop.org/show_bug.cgi?id=90192
This commit is contained in:
parent
0a2f9085e2
commit
329c542585
Notes:
Lennart Poettering
2015-05-21 19:11:59 +02:00
Backport: bugfix
@ -38,9 +38,15 @@ static int apply_timestamp(const char *path, struct timespec *ts) {
|
|||||||
assert(ts);
|
assert(ts);
|
||||||
|
|
||||||
if (stat(path, &st) >= 0) {
|
if (stat(path, &st) >= 0) {
|
||||||
/* Is the timestamp file already newer than the OS? If so, there's nothing to do. */
|
/* Is the timestamp file already newer than the OS? If
|
||||||
if (st.st_mtim.tv_sec > ts->tv_sec ||
|
* so, there's nothing to do. We ignore the nanosecond
|
||||||
(st.st_mtim.tv_sec == ts->tv_sec && st.st_mtim.tv_nsec >= ts->tv_nsec))
|
* 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;
|
return 0;
|
||||||
|
|
||||||
/* It is older? Then let's update it */
|
/* It is older? Then let's update it */
|
||||||
|
Loading…
Reference in New Issue
Block a user