Skip to content

Commit

Permalink
systemctl: do not try to acquire triggering units for template units
Browse files Browse the repository at this point in the history
(cherry picked from commit 09d6038d833468ba7c24c658597387ef699ca4fd)

Resolves: RHEL-55132
  • Loading branch information
YHNdnzj authored and lnykryn committed Aug 20, 2024
1 parent 6bec94d commit be5cdbe
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/systemctl/systemctl-util.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit be5cdbe

Please sign in to comment.