]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: hide "following" units if '--all' is not passed (#2967)
authorFranck Bui <fbui@suse.com>
Wed, 20 Apr 2016 01:18:17 +0000 (03:18 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Wed, 20 Apr 2016 01:18:17 +0000 (21:18 -0400)
No need to dump all the redundant device units on the user, just because he
specified that he wants to see units of a specific state.

This was broken by commit ebc962656cee33e3e8395f456a8208c3ca41969c.

src/systemctl/systemctl.c

index 115c00ea9cf17099e24a81c3919eb3fcaae640d8..059e985463d1bd4b09f0967922584ded75844025 100644 (file)
@@ -341,6 +341,12 @@ static bool output_show_unit(const UnitInfo *u, char **patterns) {
         if (arg_all)
                 return true;
 
+        /* Note that '--all' is not purely a state filter, but also a
+         * filter that hides units that "follow" other units (which is
+         * used for device units that appear under different names). */
+        if (!isempty(u->following))
+                return false;
+
         if (!strv_isempty(arg_states))
                 return true;
 
@@ -349,7 +355,7 @@ static bool output_show_unit(const UnitInfo *u, char **patterns) {
         if (u->job_id > 0)
                 return true;
 
-        if (streq(u->active_state, "inactive") || u->following[0])
+        if (streq(u->active_state, "inactive"))
                 return false;
 
         return true;