]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
tree-wide: use table_log_add_error()
authorYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Jan 2020 09:23:24 +0000 (18:23 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Fri, 10 Jan 2020 09:28:30 +0000 (18:28 +0900)
src/busctl/busctl.c
src/login/inhibit.c
src/login/loginctl.c
src/mount/mount-tool.c
src/network/networkctl.c
src/timedate/timedatectl.c

index aec323749caa63e1c966585fc18a68a39af36665..659621256b1e67c7204780d2a8087fd358da66cb 100644 (file)
@@ -237,7 +237,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
                                         TABLE_EMPTY,
                                         TABLE_EMPTY);
                         if (r < 0)
-                                return log_error_errno(r, "Failed to fill line: %m");
+                                return table_log_add_error(r);
 
                         continue;
                 }
@@ -254,7 +254,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
                                    TABLE_INT, PTR_TO_INT(v),
                                    TABLE_STRING, k);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add name %s to table: %m", k);
+                        return table_log_add_error(r);
 
                 r = sd_bus_get_name_creds(
                                 bus, k,
@@ -283,7 +283,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
                         } else
                                 r = table_add_many(table, TABLE_EMPTY, TABLE_EMPTY);
                         if (r < 0)
-                                return log_error_errno(r, "Failed to add fields to table: %m");
+                                return table_log_add_error(r);
 
                         r = sd_bus_creds_get_euid(creds, &uid);
                         if (r >= 0) {
@@ -297,7 +297,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
                         } else
                                 r = table_add_cell(table, NULL, TABLE_EMPTY, NULL);
                         if (r < 0)
-                                return log_error_errno(r, "Failed to add field to table: %m");
+                                return table_log_add_error(r);
 
                         (void) sd_bus_creds_get_unique_name(creds, &unique);
                         (void) sd_bus_creds_get_unit(creds, &unit);
@@ -312,7 +312,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
                                         TABLE_STRING, cn);
                 }
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add fields to table: %m");
+                        return table_log_add_error(r);
 
                 if (arg_show_machine) {
                         sd_id128_t mid;
@@ -325,7 +325,7 @@ static int list_bus_names(int argc, char **argv, void *userdata) {
 
                                 r = table_add_cell(table, NULL, TABLE_STRING, sd_id128_to_string(mid, m));
                                 if (r < 0)
-                                        return log_error_errno(r, "Failed to add field to table: %m");
+                                        return table_log_add_error(r);
 
                                 continue; /* line fully filled, no need to fill the remainder below */
                         }
index e2e1e03605bcd4655047f6673fe5004bbc8e662c..a1602031b4b6af0ad359b87d63531aa0a34146d8 100644 (file)
@@ -122,7 +122,7 @@ static int print_inhibitors(sd_bus *bus) {
                                    TABLE_STRING, why,
                                    TABLE_STRING, mode);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add table row: %m");
+                        return table_log_add_error(r);
         }
 
         r = sd_bus_message_exit_container(reply);
index 61f619de9cc5da7d7a8e428d94573719f1ce495e..bff63541771fcbfa2feacca5c45a1354d35d3912 100644 (file)
@@ -189,7 +189,7 @@ static int list_sessions(int argc, char *argv[], void *userdata) {
                                    TABLE_STRING, seat,
                                    TABLE_STRING, strna(tty));
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add row to table: %m");
+                        return table_log_add_error(r);
         }
 
         r = sd_bus_message_exit_container(reply);
@@ -246,7 +246,7 @@ static int list_users(int argc, char *argv[], void *userdata) {
                                    TABLE_UID, (uid_t) uid,
                                    TABLE_STRING, user);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add row to table: %m");
+                        return table_log_add_error(r);
         }
 
         r = sd_bus_message_exit_container(reply);
@@ -298,7 +298,7 @@ static int list_seats(int argc, char *argv[], void *userdata) {
 
                 r = table_add_cell(table, NULL, TABLE_STRING, seat);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add row to table: %m");
+                        return table_log_add_error(r);
         }
 
         r = sd_bus_message_exit_container(reply);
index babd82704c01d4fd0c85dc36445db7b992fdd752..77d9cbb452d2eaa76170400b4569454632246ae7 100644 (file)
@@ -1446,7 +1446,7 @@ static int list_devices(void) {
 
                         r = table_add_cell(table, NULL, c == COLUMN_NODE ? TABLE_PATH : TABLE_STRING, strna(x));
                         if (r < 0)
-                                return log_error_errno(r, "Failed to add cell: %m");
+                                return table_log_add_error(r);
                 }
         }
 
index de2f440b4c09a6150d82922075abf889f1425064..9a86dc6e8d29390edb73134b6914345c9e3a2a1c 100644 (file)
@@ -557,7 +557,7 @@ static int list_links(int argc, char *argv[], void *userdata) {
                                    TABLE_STRING, strna(setup_state),
                                    TABLE_SET_COLOR, on_color_setup);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         r = table_print(table, NULL);
@@ -732,7 +732,7 @@ static int dump_gateways(
                                    TABLE_EMPTY,
                                    TABLE_STRING, i == 0 ? "Gateway:" : "");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
 
                 r = in_addr_to_string(local[i].family, &local[i].address, &gateway);
                 if (r < 0)
@@ -758,7 +758,7 @@ static int dump_gateways(
                 } else
                         r = table_add_cell(table, NULL, TABLE_STRING, with_description ?: gateway);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         return 0;
@@ -789,7 +789,7 @@ static int dump_addresses(
                                    TABLE_EMPTY,
                                    TABLE_STRING, i == 0 ? "Address:" : "");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
 
                 r = in_addr_to_string(local[i].family, &local[i].address, &pretty);
                 if (r < 0)
@@ -812,7 +812,7 @@ static int dump_addresses(
                 } else
                         r = table_add_cell(table, NULL, TABLE_STRING, pretty);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         return 0;
@@ -841,7 +841,7 @@ static int dump_address_labels(sd_netlink *rtnl) {
 
         table = table_new("label", "prefix/prefixlen");
         if (!table)
-                return -ENOMEM;
+                return log_oom();
 
         if (arg_full)
                 table_set_width(table, 0);
@@ -889,14 +889,18 @@ static int dump_address_labels(sd_netlink *rtnl) {
 
                 r = table_add_cell(table, NULL, TABLE_UINT32, &label);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
 
                 r = table_add_cell_stringf(table, NULL, "%s/%u", pretty, prefixlen);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
-        return table_print(table, NULL);
+        r = table_print(table, NULL);
+        if (r < 0)
+                return log_error_errno(r, "Failed to print table: %m");
+
+        return 0;
 }
 
 static int list_address_labels(int argc, char *argv[], void *userdata) {
@@ -988,7 +992,7 @@ static int dump_lldp_neighbors(Table *table, const char *prefix, int ifindex) {
                                    TABLE_EMPTY,
                                    TABLE_STRING, c == 0 ? prefix : "");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
 
                 (void) sd_lldp_neighbor_get_system_name(n, &system_name);
                 (void) sd_lldp_neighbor_get_port_id_as_string(n, &port_id);
@@ -1001,7 +1005,7 @@ static int dump_lldp_neighbors(Table *table, const char *prefix, int ifindex) {
                                            strempty(port_description),
                                            isempty(port_description) ? "" : ")");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
 
                 c++;
         }
@@ -1024,7 +1028,7 @@ static int dump_ifindexes(Table *table, const char *prefix, const int *ifindexes
                                    TABLE_STRING, c == 0 ? prefix : "",
                                    TABLE_IFINDEX, ifindexes[c]);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         return 0;
@@ -1043,7 +1047,7 @@ static int dump_list(Table *table, const char *prefix, char **l) {
                                    TABLE_STRING, i == l ? prefix : "",
                                    TABLE_STRING, *i);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         return 0;
@@ -1054,12 +1058,12 @@ static int dump_list(Table *table, const char *prefix, char **l) {
                            TABLE_EMPTY,                                 \
                            TABLE_STRING, name ":");                     \
         if (r < 0)                                                      \
-                return r;                                               \
+                return table_log_add_error(r);                                               \
         r = table_add_cell(table, NULL,                                 \
                            info->has_stats64 ? TABLE_UINT64 : TABLE_UINT32, \
                            info->has_stats64 ? (void*) &info->stats64.val_name : (void*) &info->stats.val_name); \
         if (r < 0)                                                      \
-                return r;
+                return table_log_add_error(r);
 
 static int dump_statistics(Table *table, const LinkInfo *info) {
         int r;
@@ -1201,7 +1205,7 @@ static int link_status_one(
 
         table = table_new("dot", "key", "value");
         if (!table)
-                return -ENOMEM;
+                return log_oom();
 
         if (arg_full)
                 table_set_width(table, 0);
@@ -1218,10 +1222,10 @@ static int link_status_one(
                            TABLE_STRING, special_glyph(SPECIAL_GLYPH_BLACK_CIRCLE),
                            TABLE_SET_COLOR, on_color_operational);
         if (r < 0)
-                return r;
+                return table_log_add_error(r);
         r = table_add_cell_stringf(table, &cell, "%i: %s", info->ifindex, info->name);
         if (r < 0)
-                return r;
+                return table_log_add_error(r);
         (void) table_set_align_percent(table, cell, 0);
 
         r = table_add_many(table,
@@ -1239,14 +1243,14 @@ static int link_status_one(
                            TABLE_EMPTY,
                            TABLE_STRING, "State:");
         if (r < 0)
-                return r;
+                return table_log_add_error(r);
         r = table_add_cell_stringf(table, NULL, "%s%s%s (%s%s%s)",
                                    on_color_operational, strna(operational_state), off_color_operational,
                                    on_color_setup, strna(setup_state), off_color_setup);
         if (r < 0)
-                return r;
+                return table_log_add_error(r);
 
-        STRV_FOREACH(p, info->alternative_names)
+        STRV_FOREACH(p, info->alternative_names) {
                 if (p == info->alternative_names)
                         r = table_add_many(table,
                                            TABLE_EMPTY,
@@ -1257,6 +1261,9 @@ static int link_status_one(
                                            TABLE_EMPTY,
                                            TABLE_EMPTY,
                                            TABLE_STRING, *p);
+                if (r < 0)
+                        return table_log_add_error(r);
+        }
 
         if (path) {
                 r = table_add_many(table,
@@ -1264,7 +1271,7 @@ static int link_status_one(
                                    TABLE_STRING, "Path:",
                                    TABLE_STRING, path);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
         if (driver) {
                 r = table_add_many(table,
@@ -1272,7 +1279,7 @@ static int link_status_one(
                                    TABLE_STRING, "Driver:",
                                    TABLE_STRING, driver);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
         if (vendor) {
                 r = table_add_many(table,
@@ -1280,7 +1287,7 @@ static int link_status_one(
                                    TABLE_STRING, "Vendor:",
                                    TABLE_STRING, vendor);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
         if (model) {
                 r = table_add_many(table,
@@ -1288,7 +1295,7 @@ static int link_status_one(
                                    TABLE_STRING, "Model:",
                                    TABLE_STRING, model);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         if (info->has_mac_address) {
@@ -1301,14 +1308,14 @@ static int link_status_one(
                                    TABLE_EMPTY,
                                    TABLE_STRING, "HW Address:");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
                 r = table_add_cell_stringf(table, NULL, "%s%s%s%s",
                                            ether_addr_to_string(&info->mac_address, ea),
                                            description ? " (" : "",
                                            strempty(description),
                                            description ? ")" : "");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         if (info->has_permanent_mac_address) {
@@ -1321,14 +1328,14 @@ static int link_status_one(
                                    TABLE_EMPTY,
                                    TABLE_STRING, "HW Permanent Address:");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
                 r = table_add_cell_stringf(table, NULL, "%s%s%s%s",
                                            ether_addr_to_string(&info->permanent_mac_address, ea),
                                            description ? " (" : "",
                                            strempty(description),
                                            description ? ")" : "");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         if (info->mtu > 0) {
@@ -1341,7 +1348,7 @@ static int link_status_one(
                                    TABLE_EMPTY,
                                    TABLE_STRING, "MTU:");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
                 r = table_add_cell_stringf(table, NULL, "%" PRIu32 "%s%s%s%s%s%s%s",
                                            info->mtu,
                                            info->min_mtu > 0 || info->max_mtu > 0 ? " (" : "",
@@ -1352,7 +1359,7 @@ static int link_status_one(
                                            info->max_mtu > 0 ? max_str : "",
                                            info->min_mtu > 0 || info->max_mtu > 0 ? ")" : "");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         if (streq_ptr(info->netdev_kind, "bridge")) {
@@ -1379,7 +1386,7 @@ static int link_status_one(
                                    TABLE_STRING, "Multicast IGMP Version:",
                                    TABLE_UINT8, info->mcast_igmp_version);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
 
         } else if (streq_ptr(info->netdev_kind, "vxlan")) {
                 if (info->vxlan_info.vni > 0) {
@@ -1388,7 +1395,7 @@ static int link_status_one(
                                            TABLE_STRING, "VNI:",
                                            TABLE_UINT32, info->vxlan_info.vni);
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
 
                 if (IN_SET(info->vxlan_info.group_family, AF_INET, AF_INET6)) {
@@ -1398,7 +1405,7 @@ static int link_status_one(
                                            info->vxlan_info.group_family == AF_INET ? TABLE_IN_ADDR : TABLE_IN6_ADDR,
                                            &info->vxlan_info.group);
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
 
                 if (IN_SET(info->vxlan_info.local_family, AF_INET, AF_INET6)) {
@@ -1408,7 +1415,7 @@ static int link_status_one(
                                            info->vxlan_info.local_family == AF_INET ? TABLE_IN_ADDR : TABLE_IN6_ADDR,
                                            &info->vxlan_info.local);
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
 
                 if (info->vxlan_info.dest_port > 0) {
@@ -1417,7 +1424,7 @@ static int link_status_one(
                                            TABLE_STRING, "Destination Port:",
                                            TABLE_UINT16, be16toh(info->vxlan_info.dest_port));
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
 
                 if (info->vxlan_info.link > 0) {
@@ -1426,7 +1433,7 @@ static int link_status_one(
                                            TABLE_STRING, "Underlying Device:",
                                            TABLE_IFINDEX, info->vxlan_info.link);
                         if (r < 0)
-                                 return r;
+                                 return table_log_add_error(r);
                 }
         }
 
@@ -1438,7 +1445,7 @@ static int link_status_one(
                                    TABLE_EMPTY,
                                    TABLE_STRING, "WiFi access point:");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
 
                 if (info->ssid)
                         esc = cescape(info->ssid);
@@ -1447,7 +1454,7 @@ static int link_status_one(
                                            strnull(esc),
                                            ether_addr_to_string(&info->bssid, buf));
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         if (info->has_bitrates) {
@@ -1457,12 +1464,12 @@ static int link_status_one(
                                    TABLE_EMPTY,
                                    TABLE_STRING, "Bit Rate (Tx/Rx):");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
                 r = table_add_cell_stringf(table, NULL, "%sbps/%sbps",
                                            format_bytes_full(tx, sizeof tx, info->tx_bitrate, 0),
                                            format_bytes_full(rx, sizeof rx, info->rx_bitrate, 0));
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         if (info->has_tx_queues || info->has_rx_queues) {
@@ -1470,10 +1477,10 @@ static int link_status_one(
                                    TABLE_EMPTY,
                                    TABLE_STRING, "Queue Length (Tx/Rx):");
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
                 r = table_add_cell_stringf(table, NULL, "%" PRIu32 "/%" PRIu32, info->tx_queues, info->rx_queues);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         if (info->has_ethtool_link_info) {
@@ -1486,7 +1493,7 @@ static int link_status_one(
                                            TABLE_STRING, "Auto negotiation:",
                                            TABLE_BOOLEAN, info->autonegotiation == AUTONEG_ENABLE);
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
 
                 if (info->speed > 0) {
@@ -1495,7 +1502,7 @@ static int link_status_one(
                                            TABLE_STRING, "Speed:",
                                            TABLE_BPS, (uint64_t) info->speed);
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
 
                 if (duplex) {
@@ -1504,7 +1511,7 @@ static int link_status_one(
                                            TABLE_STRING, "Duplex:",
                                            TABLE_STRING, duplex);
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
 
                 if (port) {
@@ -1513,7 +1520,7 @@ static int link_status_one(
                                            TABLE_STRING, "Port:",
                                            TABLE_STRING, port);
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
                 }
         }
 
@@ -1549,7 +1556,7 @@ static int link_status_one(
                                    TABLE_STRING, "Time Zone:",
                                    TABLE_STRING, tz);
                 if (r < 0)
-                        return r;
+                        return table_log_add_error(r);
         }
 
         r = dump_lldp_neighbors(table, "Connected To:", info->ifindex);
@@ -1562,7 +1569,7 @@ static int link_status_one(
 
         r = table_print(table, NULL);
         if (r < 0)
-                return r;
+                return log_error_errno(r, "Failed to print table: %m");
 
         return show_logs(info);
 }
@@ -1582,7 +1589,7 @@ static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
 
         table = table_new("dot", "key", "value");
         if (!table)
-                return -ENOMEM;
+                return log_oom();
 
         if (arg_full)
                 table_set_width(table, 0);
@@ -1602,6 +1609,8 @@ static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
                            TABLE_STRING, "State:",
                            TABLE_STRING, strna(operational_state),
                            TABLE_SET_COLOR, on_color_operational);
+        if (r < 0)
+                return table_log_add_error(r);
 
         r = dump_addresses(rtnl, table, 0);
         if (r < 0)
@@ -1632,7 +1641,7 @@ static int system_status(sd_netlink *rtnl, sd_hwdb *hwdb) {
 
         r = table_print(table, NULL);
         if (r < 0)
-                return r;
+                return log_error_errno(r, "Failed to print table: %m");
 
         return show_logs(NULL);
 }
@@ -1752,7 +1761,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                           "port id",
                           "port description");
         if (!table)
-                return -ENOMEM;
+                return log_oom();
 
         if (arg_full)
                 table_set_width(table, 0);
@@ -1844,7 +1853,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
                                            TABLE_STRING, strna(port_id),
                                            TABLE_STRING, strna(port_description));
                         if (r < 0)
-                                return r;
+                                return table_log_add_error(r);
 
                         m++;
                 }
@@ -1852,7 +1861,7 @@ static int link_lldp_status(int argc, char *argv[], void *userdata) {
 
         r = table_print(table, NULL);
         if (r < 0)
-                return r;
+                return log_error_errno(r, "Failed to print table: %m");
 
         if (arg_legend) {
                 lldp_capabilities_legend(all);
index 17297ab22889202a756f8e7660c6c899722f0136..7cfeeb8532527bd0732a48a67be13277897e5294 100644 (file)
@@ -100,7 +100,7 @@ static int print_status_info(const StatusInfo *i) {
                            TABLE_STRING, "Local time:",
                            TABLE_STRING, have_time && n > 0 ? a : "n/a");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         if (have_time)
                 n = strftime(a, sizeof a, "%a %Y-%m-%d %H:%M:%S UTC", gmtime_r(&sec, &tm));
@@ -109,7 +109,7 @@ static int print_status_info(const StatusInfo *i) {
                            TABLE_STRING, "Universal time:",
                            TABLE_STRING, have_time && n > 0 ? a : "n/a");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         if (i->rtc_time > 0) {
                 time_t rtc_sec;
@@ -122,18 +122,18 @@ static int print_status_info(const StatusInfo *i) {
                            TABLE_STRING, "RTC time:",
                            TABLE_STRING, i->rtc_time > 0 && n > 0 ? a : "n/a");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         if (have_time)
                 n = strftime(a, sizeof a, "%Z, %z", localtime_r(&sec, &tm));
 
         r = table_add_cell(table, NULL, TABLE_STRING, "Time zone:");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell_stringf(table, NULL, "%s (%s)", strna(i->timezone), have_time && n > 0 ? a : "n/a");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
 
         /* Restore the $TZ */
@@ -154,7 +154,7 @@ static int print_status_info(const StatusInfo *i) {
                            TABLE_STRING, "RTC in local TZ:",
                            TABLE_BOOLEAN, i->rtc_local);
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_print(table, NULL);
         if (r < 0)
@@ -429,29 +429,29 @@ static int print_ntp_status_info(NTPStatusInfo *i) {
 
         r = table_add_cell(table, NULL, TABLE_STRING, "Server:");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell_stringf(table, NULL, "%s (%s)", i->server_address, i->server_name);
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell(table, NULL, TABLE_STRING, "Poll interval:");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell_stringf(table, NULL, "%s (min: %s; max %s)",
                                    format_timespan(ts, sizeof(ts), i->poll_interval, 0),
                                    format_timespan(tmin, sizeof(tmin), i->poll_min, 0),
                                    format_timespan(tmax, sizeof(tmax), i->poll_max, 0));
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         if (i->packet_count == 0) {
                 r = table_add_many(table,
                                    TABLE_STRING, "Packet count:",
                                    TABLE_STRING, "0");
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add cell(s): %m");
+                        return table_log_add_error(r);
 
                 r = table_print(table, NULL);
                 if (r < 0)
@@ -487,44 +487,44 @@ static int print_ntp_status_info(NTPStatusInfo *i) {
                            TABLE_UINT32, i->stratum,
                            TABLE_STRING, "Reference:");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         if (i->stratum <= 1)
                 r = table_add_cell(table, NULL, TABLE_STRING, i->reference.str);
         else
                 r = table_add_cell_stringf(table, NULL, "%" PRIX32, be32toh(i->reference.val));
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell(table, NULL, TABLE_STRING, "Precision:");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell_stringf(table, NULL, "%s (%" PRIi32 ")",
                                    format_timespan(ts, sizeof(ts), DIV_ROUND_UP((nsec_t) (exp2(i->precision) * NSEC_PER_SEC), NSEC_PER_USEC), 0),
                                    i->precision);
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell(table, NULL, TABLE_STRING, "Root distance:");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell_stringf(table, NULL, "%s (max: %s)",
                                    format_timespan(ts, sizeof(ts), root_distance, 0),
                                    format_timespan(tmax, sizeof(tmax), i->root_distance_max, 0));
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell(table, NULL, TABLE_STRING, "Offset:");
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_cell_stringf(table, NULL, "%s%s",
                                    offset_sign ? "+" : "-",
                                    format_timespan(ts, sizeof(ts), offset, 0));
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         r = table_add_many(table,
                            TABLE_STRING, "Delay:",
@@ -534,16 +534,16 @@ static int print_ntp_status_info(NTPStatusInfo *i) {
                            TABLE_STRING, "Packet count:",
                            TABLE_UINT64, i->packet_count);
         if (r < 0)
-                return log_error_errno(r, "Failed to add cell(s): %m");
+                return table_log_add_error(r);
 
         if (!i->spike) {
                 r = table_add_cell(table, NULL, TABLE_STRING, "Frequency:");
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add cell(s): %m");
+                        return table_log_add_error(r);
 
                 r = table_add_cell_stringf(table, NULL, "%+.3fppm", (double) i->freq / 0x10000);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to add cell(s): %m");
+                        return table_log_add_error(r);
         }
 
         r = table_print(table, NULL);