naccyde / rpms / systemd

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