chiark / gitweb /
systemctl: cat: fix error handling
authorIvan Shapovalov <intelfx100@gmail.com>
Wed, 4 Feb 2015 22:56:58 +0000 (01:56 +0300)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Thu, 5 Feb 2015 01:10:27 +0000 (20:10 -0500)
- correctly check for local vs. remote transport
- return after receiving error from expand_names()

src/systemctl/systemctl.c

index 083b6180e394d8a755a0b1688900ee3095ce4cd2..567b467bae9d15e1b179552ca957a984b9fe8790 100644 (file)
@@ -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();