diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-16 18:20:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-09-16 18:20:20 +0000 |
commit | 8612d3d858fa108e5732a586d4e2d0227ae34422 (patch) | |
tree | 33e7f8b3d5caa6c44b4d6759cb25d3eff4b2d975 /src/systemctl | |
parent | Adding debian version 256.2-1. (diff) | |
download | systemd-8612d3d858fa108e5732a586d4e2d0227ae34422.tar.xz systemd-8612d3d858fa108e5732a586d4e2d0227ae34422.zip |
Merging upstream version 256.4.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/systemctl')
-rw-r--r-- | src/systemctl/systemctl-util.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/src/systemctl/systemctl-util.c b/src/systemctl/systemctl-util.c index 2482b7c..38e1f23 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) { @@ -383,8 +388,8 @@ void warn_triggering_units(sd_bus *bus, const char *unit, const char *operation, r = get_active_triggering_units(bus, unit, ignore_masked, &triggered_by); if (r < 0) { - log_warning_errno(r, - "Failed to get triggering units for '%s', ignoring: %m", unit); + if (r != -ENOENT) /* A linked unit might have disappeared after disabling */ + log_warning_errno(r, "Failed to get triggering units for '%s', ignoring: %m", unit); return; } |