chiark / gitweb /
systemctl: warn about triggering units only at the end
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Tue, 18 Sep 2012 20:03:34 +0000 (22:03 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 19 Sep 2012 06:27:34 +0000 (08:27 +0200)
Instead of checking each unit separately, check once at the end. This
should avoid spurious warnings about a service being triggerable by
other stuff.

TODO
src/systemctl/systemctl.c

diff --git a/TODO b/TODO
index c941cb070c8caccbe44926ae9ebe0d9be1712268..ec961eaaf169f84df3d248e490c76edcd30da18a 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,10 +1,4 @@
 Bugfixes:
-* there is nothing to warn about here :)
-  $ systemctl stop systemd-udevd.service systemd-udevd-kernel.socket systemd-udevd-control.socket
-  Warning: Stopping systemd-udevd.service, but it can still be activated by:
-  systemd-udevd-control.socket
-  systemd-udevd-kernel.socket
-
 * check systemd-tmpfiles for selinux context hookup for mknod(), symlink() and similar
 
 * swap units that are activated by one name but shown in the kernel under another are semi-broken
index 729d4dd324ea1848f419da30e167f3dc3404880e..cc9c775251d813c740916b285acff37ff4241569 100644 (file)
@@ -1584,11 +1584,6 @@ static int start_unit_one(
                 p = NULL;
         }
 
-        /* When stopping a unit warn if it can still be triggered by
-         * another active unit (socket, path, timer) */
-        if (!arg_quiet && streq(method, "StopUnit"))
-                check_triggering_units(bus, name);
-
         return 0;
 }
 
@@ -1723,6 +1718,16 @@ static int start_unit(DBusConnection *bus, char **args) {
                         ret = r;
                         goto finish;
                 }
+
+                /* When stopping units, warn if they can still be triggered by
+                 * another active unit (socket, path, timer) */
+                if (!arg_quiet && streq(method, "StopUnit")) {
+                        if (one_name)
+                                check_triggering_units(bus, one_name);
+                        else
+                                STRV_FOREACH(name, args+1)
+                                        check_triggering_units(bus, *name);
+                }
         }
 
 finish: