dcavalca / rpms / systemd

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