]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/systemctl/systemctl.c
tree-wide: drop {} from one-line if blocks
[thirdparty/systemd.git] / src / systemctl / systemctl.c
index 8d80aae182aaf99766996b462637a40ee16c8270..a82b9b83a2356ad9939c544f16bd2cecbef7f6ca 100644 (file)
@@ -535,10 +535,8 @@ static int get_unit_list(
                 return bus_log_create_error(r);
 
         r = sd_bus_call(bus, m, 0, &error, &reply);
-        if (r < 0) {
-                log_error("Failed to list units: %s", bus_error_message(&error, r));
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to list units: %s", bus_error_message(&error, r));
 
         r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "(ssssssouso)");
         if (r < 0)
@@ -605,7 +603,7 @@ static int get_unit_list_recursive(
         r = set_put(replies, reply);
         if (r < 0) {
                 sd_bus_message_unref(reply);
-                return r;
+                return log_oom();
         }
 
         if (arg_recursive) {
@@ -614,7 +612,7 @@ static int get_unit_list_recursive(
 
                 r = sd_get_machine_names(&machines);
                 if (r < 0)
-                        return r;
+                        return log_error_errno(r, "Failed to get machine names: %m");
 
                 STRV_FOREACH(i, machines) {
                         _cleanup_bus_flush_close_unref_ sd_bus *container = NULL;
@@ -622,7 +620,7 @@ static int get_unit_list_recursive(
 
                         r = sd_bus_open_system_machine(&container, *i);
                         if (r < 0) {
-                                log_error_errno(r, "Failed to connect to container %s: %m", *i);
+                                log_warning_errno(r, "Failed to connect to container %s, ignoring: %m", *i);
                                 continue;
                         }
 
@@ -635,7 +633,7 @@ static int get_unit_list_recursive(
                         r = set_put(replies, reply);
                         if (r < 0) {
                                 sd_bus_message_unref(reply);
-                                return r;
+                                return log_oom();
                         }
                 }
 
@@ -1474,6 +1472,7 @@ static int list_dependencies_get_dependencies(sd_bus *bus, const char *name, cha
                                        "Requisite\0"
                                        "RequisiteOverridable\0"
                                        "Wants\0"
+                                       "ConsistsOf\0"
                                        "BindsTo\0",
                 [DEPENDENCY_REVERSE] = "RequiredBy\0"
                                        "RequiredByOverridable\0"
@@ -1743,7 +1742,7 @@ static int get_machine_list(
         _cleanup_free_ char *hn = NULL;
         size_t sz = 0;
         char **i;
-        int c = 0;
+        int c = 0, r;
 
         hn = gethostname_malloc();
         if (!hn)
@@ -1761,7 +1760,10 @@ static int get_machine_list(
                 c++;
         }
 
-        sd_get_machine_names(&m);
+        r = sd_get_machine_names(&m);
+        if (r < 0)
+                return log_error_errno(r, "Failed to get machine list: %m");
+
         STRV_FOREACH(i, m) {
                 _cleanup_free_ char *class = NULL;
 
@@ -3583,7 +3585,7 @@ static void print_status_info(
                 }
         }
 
-        if (i->id && arg_transport == BUS_TRANSPORT_LOCAL) {
+        if (i->id && arg_transport == BUS_TRANSPORT_LOCAL)
                 show_journal_by_unit(
                                 stdout,
                                 i->id,
@@ -3596,7 +3598,6 @@ static void print_status_info(
                                 SD_JOURNAL_LOCAL_ONLY,
                                 arg_scope == UNIT_FILE_SYSTEM,
                                 ellipsized);
-        }
 
         if (i->need_daemon_reload)
                 warn_unit_file_changed(i->id);
@@ -4267,10 +4268,8 @@ static int show_one(
                         &error,
                         &reply,
                         "s", "");
-        if (r < 0) {
-                log_error("Failed to get properties: %s", bus_error_message(&error, r));
-                return r;
-        }
+        if (r < 0)
+                return log_error_errno(r, "Failed to get properties: %s", bus_error_message(&error, r));
 
         r = sd_bus_message_enter_container(reply, SD_BUS_TYPE_ARRAY, "{sv}");
         if (r < 0)