summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCireo <reid.price@gmail.com>2016-09-01 02:04:36 -0700
committerLennart Poettering <lennart@poettering.net>2016-09-01 11:04:36 +0200
commita6405ca288ed3458589c82b6c6ddf87e8c054858 (patch)
treec5b6f66443386aa992e471b167facfb620db155f /src
parent8be16f23e42854a5cfd2d6edb5d3719a7c1508aa (diff)
systemctl: usable status command for special units (#4072)
Prior to this commit, users could be given an unusable command to run if they attempted to stop or start special services. For example: $ systemctl stop -- -.mount Failed to stop -.mount: Operation refused, unit -.mount may be \ requested by dependency only. See system logs and 'systemctl status -.mount' for details. $ systemctl status -.mount systemctl: invalid option -- '.' This adds a '--' to the example command in these situations.
Diffstat (limited to 'src')
-rw-r--r--src/systemctl/systemctl.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 682805045d..5912441168 100644
--- a/src/systemctl/systemctl.c
+++ b/src/systemctl/systemctl.c
@@ -2720,9 +2720,10 @@ static int start_unit_one(
if (!sd_bus_error_has_name(error, BUS_ERROR_NO_SUCH_UNIT) &&
!sd_bus_error_has_name(error, BUS_ERROR_UNIT_MASKED))
- log_error("See %s logs and 'systemctl%s status %s' for details.",
+ log_error("See %s logs and 'systemctl%s status%s %s' for details.",
arg_scope == UNIT_FILE_SYSTEM ? "system" : "user",
arg_scope == UNIT_FILE_SYSTEM ? "" : " --user",
+ name[0] == '-' ? " --" : "",
name);
return r;