teknoraver / rpms / systemd

Forked from rpms/systemd 3 months ago
Clone

Blame SOURCES/0831-logind-schedule-idle-check-full-interval-from-now-if.patch

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