dryang / rpms / systemd

Forked from rpms/systemd 2 years ago
Clone
6f381c
From 3c2d2345814935cea8525e802e764fb2949eb3df Mon Sep 17 00:00:00 2001
6f381c
From: Luca Boccassi <luca.boccassi@microsoft.com>
6f381c
Date: Mon, 27 Dec 2021 18:22:43 +0000
6f381c
Subject: [PATCH] core: do not touch /run/systemd/systemd-units-load from user
6f381c
 session instances
6f381c
6f381c
Follow-up for: https://github.com/systemd/systemd/commit/15b9243c0d7f6d1531fa65dbc01bd11e8e6c12ca
6f381c
Fixes: https://github.com/systemd/systemd/issues/21911
6f381c
6f381c
(cherry picked from commit 4b3ad81bfafcd97acb06db463495e348d159d8e6)
6f381c
6f381c
Related: #2136869
6f381c
---
6f381c
 src/core/manager.c | 7 ++++---
6f381c
 1 file changed, 4 insertions(+), 3 deletions(-)
6f381c
6f381c
diff --git a/src/core/manager.c b/src/core/manager.c
6f381c
index a9cd51b624..e083596e58 100644
6f381c
--- a/src/core/manager.c
6f381c
+++ b/src/core/manager.c
6f381c
@@ -3555,9 +3555,10 @@ int manager_reload(Manager *m) {
6f381c
         manager_catchup(m);
6f381c
 
6f381c
         /* Create a file which will indicate when the manager started loading units the last time. */
6f381c
-        (void) touch_file("/run/systemd/systemd-units-load", false,
6f381c
-                m->timestamps[MANAGER_TIMESTAMP_UNITS_LOAD].realtime ?: now(CLOCK_REALTIME),
6f381c
-                UID_INVALID, GID_INVALID, 0444);
6f381c
+        if (MANAGER_IS_SYSTEM(m))
6f381c
+                (void) touch_file("/run/systemd/systemd-units-load", false,
6f381c
+                        m->timestamps[MANAGER_TIMESTAMP_UNITS_LOAD].realtime ?: now(CLOCK_REALTIME),
6f381c
+                        UID_INVALID, GID_INVALID, 0444);
6f381c
 
6f381c
         /* Sync current state of bus names with our set of listening units */
6f381c
         q = manager_enqueue_sync_bus_names(m);