richardphibel / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
594167
From 4147bdd9212ece576be2f481dff41daf58788f04 Mon Sep 17 00:00:00 2001
594167
From: Michal Sekletar <msekleta@redhat.com>
594167
Date: Fri, 9 Sep 2022 13:38:58 +0200
594167
Subject: [PATCH] logind: schedule idle check full interval from now if we
594167
 couldn't figure out atime timestamp
594167
594167
(cherry picked from commit ab7ae746c6eed3074aa7edc6ae9ecfbac157e0da)
594167
594167
Related: #2100464
594167
---
594167
 src/login/logind-session.c | 5 ++++-
594167
 1 file changed, 4 insertions(+), 1 deletion(-)
594167
594167
diff --git a/src/login/logind-session.c b/src/login/logind-session.c
594167
index a110b6f1c1..1d6aa80913 100644
594167
--- a/src/login/logind-session.c
594167
+++ b/src/login/logind-session.c
594167
@@ -706,7 +706,10 @@ static int session_dispatch_stop_on_idle(sd_event_source *source, uint64_t t, vo
594167
                 return session_stop(s, /* force */ true);
594167
         }
594167
 
594167
-        r = sd_event_source_set_time(source, usec_add(ts.monotonic, s->manager->stop_idle_session_usec));
594167
+        r = sd_event_source_set_time(
594167
+                        source,
594167
+                        usec_add(dual_timestamp_is_set(&ts) ? ts.monotonic : now(CLOCK_MONOTONIC),
594167
+                                 s->manager->stop_idle_session_usec));
594167
         if (r < 0)
594167
                 return log_error_errno(r, "Failed to configure stop on idle session event source: %m");
594167