]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: do not try to acquire triggering units for template units 33627/head
authorMike Yuan <me@yhndnzj.com>
Sun, 30 Jun 2024 11:12:45 +0000 (13:12 +0200)
committerMike Yuan <me@yhndnzj.com>
Thu, 4 Jul 2024 18:36:04 +0000 (20:36 +0200)
src/systemctl/systemctl-util.c

index 1b69b1905c7d5eb31f6a24523621e0cf99d06c5f..a3101911cdfb954932cc3bd10fb401b54d7188da 100644 (file)
@@ -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) {