summaryrefslogtreecommitdiff
path: root/src/systemctl
diff options
context:
space:
mode:
authorFrantisek Sumsal <frantisek@sumsal.cz>2019-04-11 14:34:32 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2019-05-30 21:11:44 +0200
commit4eb5312079962fceb22c1b730087d724d02fee8b (patch)
tree29b66b0998aaa43478aa3579352f470d0f22a0ad /src/systemctl
parentcfa0ce187fe31095f407748fe6c7eccae1eb9257 (diff)
downloadsystemd-4eb5312079962fceb22c1b730087d724d02fee8b.tar.gz
systemctl: process all units matched by a glob in the cat verb by default
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.
Diffstat (limited to 'src/systemctl')
-rw-r--r--src/systemctl/systemctl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 0574a9f4ce..cca1508309 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -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.");