From: Ivan Shapovalov Date: Wed, 4 Feb 2015 22:56:58 +0000 (+0300) Subject: systemctl: cat: fix error handling X-Git-Tag: v219~142 X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;ds=sidebyside;h=3e7eed8497098d1b09fd4ae1260c5242e16a8127;p=elogind.git systemctl: cat: fix error handling - correctly check for local vs. remote transport - return after receiving error from expand_names() --- diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c index 083b6180e..567b467ba 100644 --- a/src/systemctl/systemctl.c +++ b/src/systemctl/systemctl.c @@ -4594,8 +4594,8 @@ static int cat(sd_bus *bus, char **args) { assert(args); - if (arg_host) { - log_error("Option --host cannot be used with 'cat'"); + if (arg_transport != BUS_TRANSPORT_LOCAL) { + log_error("Cannot remotely cat units"); return -EINVAL; } @@ -4605,7 +4605,7 @@ static int cat(sd_bus *bus, char **args) { r = expand_names(bus, args + 1, NULL, &names); if (r < 0) - log_error_errno(r, "Failed to expand names: %m"); + return log_error_errno(r, "Failed to expand names: %m"); avoid_bus_cache = !bus || avoid_bus();