[systemd-devel] [PATCHv2 2/4] systemctl: cat: fix error handling

Ivan Shapovalov intelfx100 at gmail.com
Wed Feb 4 14:56:58 PST 2015


- correctly check for local vs. remote transport
- return after receiving error from expand_names()
---
 src/systemctl/systemctl.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/systemctl/systemctl.c b/src/systemctl/systemctl.c
index 083b618..567b467 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();
 
-- 
2.2.2



More information about the systemd-devel mailing list