Merge pull request #22600 from poettering/timestamp_is_set-more

make more use of timestamp_is_set()
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2022-02-23 08:59:49 +01:00
committed by GitHub
12 changed files with 94 additions and 21 deletions
+1 -1
View File
@@ -641,7 +641,7 @@ _public_ int sd_watchdog_enabled(int unset_environment, uint64_t *usec) {
r = safe_atou64(s, &u);
if (r < 0)
goto finish;
if (u <= 0 || u >= USEC_INFINITY) {
if (!timestamp_is_set(u)) {
r = -EINVAL;
goto finish;
}
+3 -3
View File
@@ -64,15 +64,15 @@ static void patch_realtime(
assert(realtime);
x = timespec_load(&st->st_ctim);
if (x > 0 && x != USEC_INFINITY && x < *realtime)
if (timestamp_is_set(x) && x < *realtime)
*realtime = x;
x = timespec_load(&st->st_atim);
if (x > 0 && x != USEC_INFINITY && x < *realtime)
if (timestamp_is_set(x) && x < *realtime)
*realtime = x;
x = timespec_load(&st->st_mtim);
if (x > 0 && x != USEC_INFINITY && x < *realtime)
if (timestamp_is_set(x) && x < *realtime)
*realtime = x;
/* Let's read the original creation time, if possible. Ideally we'd just query the creation time the