c645a5a5e2
Resolves: RHEL-55132,RHEL-55728,RHEL-55734,RHEL-55746
49 lines
1.5 KiB
Diff
49 lines
1.5 KiB
Diff
From a81dc0cad9c24df7c005378fe2c438a98054a7d3 Mon Sep 17 00:00:00 2001
|
|
From: Mike Yuan <me@yhndnzj.com>
|
|
Date: Sun, 30 Jun 2024 13:12:45 +0200
|
|
Subject: [PATCH] systemctl: do not try to acquire triggering units for
|
|
template units
|
|
|
|
(cherry picked from commit 09d6038d833468ba7c24c658597387ef699ca4fd)
|
|
|
|
Resolves: RHEL-55132
|
|
---
|
|
src/systemctl/systemctl-util.c | 13 +++++++++----
|
|
1 file changed, 9 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/src/systemctl/systemctl-util.c b/src/systemctl/systemctl-util.c
|
|
index 2482b7ccb2..08a3ebe128 100644
|
|
--- a/src/systemctl/systemctl-util.c
|
|
+++ b/src/systemctl/systemctl-util.c
|
|
@@ -327,14 +327,15 @@ int get_active_triggering_units(sd_bus *bus, const char *unit, bool ignore_maske
|
|
if (r < 0)
|
|
return r;
|
|
|
|
+ if (unit_name_is_valid(name, UNIT_NAME_TEMPLATE))
|
|
+ goto skip;
|
|
+
|
|
if (ignore_masked) {
|
|
r = unit_is_masked(bus, name);
|
|
if (r < 0)
|
|
return r;
|
|
- if (r > 0) {
|
|
- *ret = NULL;
|
|
- return 0;
|
|
- }
|
|
+ if (r > 0)
|
|
+ goto skip;
|
|
}
|
|
|
|
dbus_path = unit_dbus_path_from_name(name);
|
|
@@ -370,6 +371,10 @@ int get_active_triggering_units(sd_bus *bus, const char *unit, bool ignore_maske
|
|
|
|
*ret = TAKE_PTR(active);
|
|
return 0;
|
|
+
|
|
+skip:
|
|
+ *ret = NULL;
|
|
+ return 0;
|
|
}
|
|
|
|
void warn_triggering_units(sd_bus *bus, const char *unit, const char *operation, bool ignore_masked) {
|