[systemd-devel] [PATCH] systemctl: fix misleading warning message

Michal Sekletar msekleta at redhat.com
Mon Sep 17 12:23:49 PDT 2012


From: Michal Sekletar <sekletar.m at gmail.com>

When stopping multiple units at once do not print warning about
triggering units when they are stopped by the same command.
---
 src/systemctl/systemctl.c |   10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index cc9c775..f8bcb2c 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -1443,7 +1443,8 @@ finish:
 
 static void check_triggering_units(
                 DBusConnection *bus,
-                const char *unit_name) {
+                const char *unit_name,
+                char **args) {
 
         DBusMessage _cleanup_dbus_msg_unref_ *reply = NULL;
         DBusMessageIter iter, sub;
@@ -1503,7 +1504,8 @@ static void check_triggering_units(
                 r = check_one_unit(bus, service_trigger, true);
                 if (r < 0)
                         return;
-                if (r == 0) {
+
+                if (r == 0 && !strv_find(args, service_trigger)) {
                         if (print_warning_label) {
                                 log_warning("Warning: Stopping %s, but it can still be activated by:", unit_name);
                                 print_warning_label = false;
@@ -1723,10 +1725,10 @@ static int start_unit(DBusConnection *bus, char **args) {
                  * another active unit (socket, path, timer) */
                 if (!arg_quiet && streq(method, "StopUnit")) {
                         if (one_name)
-                                check_triggering_units(bus, one_name);
+                                check_triggering_units(bus, one_name, args + 1);
                         else
                                 STRV_FOREACH(name, args+1)
-                                        check_triggering_units(bus, *name);
+                                        check_triggering_units(bus, *name, args + 1);
                 }
         }
 
-- 
1.7.9.6 (Apple Git-31.1)



More information about the systemd-devel mailing list