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