]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
systemctl: process all units matched by a glob in the cat verb by default
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 11 Apr 2019 12:34:32 +0000 (14:34 +0200)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 30 May 2019 19:11:44 +0000 (21:11 +0200)
Originally, `systemctl cat` would match only active units, for example:

$ systemctl cat sshd.service

would cat the sshd.service unit file even if the service was inactive.
However:

$ systemctl cat ssh*

would show it only if it was active.

Let's unify the behavior and cat all unit files regardless of a state,
if no state was given explicitly to filter.

src/systemctl/systemctl.c

index 0574a9f4cebc2a3ea1039c9754027ca3c4b48a6e..cca150830979a317eca98b14434bae6eb1c8929a 100644 (file)
@@ -5865,6 +5865,11 @@ static int cat(int argc, char *argv[], void *userdata) {
         bool first = true;
         int r;
 
+        /* Include all units by default - i.e. continue as if the --all
+         * option was used */
+        if (strv_isempty(arg_states))
+                arg_all = true;
+
         if (arg_transport != BUS_TRANSPORT_LOCAL)
                 return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "Cannot remotely cat units.");