chiark / gitweb /
treewide: more log_*_errno() conversions, multiline calls
[elogind.git] / src / run / run.c
index f8f0ea2832851f8f0fdb48d105eab70f1010e58e..8c7bd5c92d890ae5ab25e0cff6041410180a43c9 100644 (file)
@@ -499,7 +499,7 @@ static int start_transient_scope(
 
                 r = get_group_creds(&arg_exec_group, &gid);
                 if (r < 0) {
-                        log_error("Failed to resolve group %s: %s", arg_exec_group, strerror(-r));
+                        log_error_errno(r, "Failed to resolve group %s: %m", arg_exec_group);
                         return r;
                 }
 
@@ -516,7 +516,7 @@ static int start_transient_scope(
 
                 r = get_user_creds(&arg_exec_user, &uid, &gid, &home, &shell);
                 if (r < 0) {
-                        log_error("Failed to resolve user %s: %s", arg_exec_user, strerror(-r));
+                        log_error_errno(r, "Failed to resolve user %s: %m", arg_exec_user);
                         return r;
                 }
 
@@ -562,7 +562,7 @@ static int start_transient_scope(
 
 int main(int argc, char* argv[]) {
         _cleanup_bus_error_free_ sd_bus_error error = SD_BUS_ERROR_NULL;
-        _cleanup_bus_unref_ sd_bus *bus = NULL;
+        _cleanup_bus_close_unref_ sd_bus *bus = NULL;
         _cleanup_free_ char *description = NULL, *command = NULL;
         int r;
 
@@ -573,9 +573,11 @@ int main(int argc, char* argv[]) {
         if (r <= 0)
                 goto finish;
 
-        r = find_binary(argv[optind], &command);
+        r = find_binary(argv[optind], arg_transport == BUS_TRANSPORT_LOCAL, &command);
         if (r < 0) {
-                log_error("Failed to find executable %s: %s", argv[optind], strerror(-r));
+                log_error_errno(r, "Failed to find executable %s%s: %m",
+                                argv[optind],
+                                arg_transport == BUS_TRANSPORT_LOCAL ? "" : " on local system");
                 goto finish;
         }
         argv[optind] = command;
@@ -592,7 +594,7 @@ int main(int argc, char* argv[]) {
 
         r = bus_open_transport_systemd(arg_transport, arg_host, arg_user, &bus);
         if (r < 0) {
-                log_error("Failed to create bus connection: %s", strerror(-r));
+                log_error_errno(r, "Failed to create bus connection: %m");
                 goto finish;
         }