]> git.ipfire.org Git - thirdparty/systemd.git/blobdiff - src/network/networkd-route.c
Merge pull request #20109 from keszybz/timestamp-macros
[thirdparty/systemd.git] / src / network / networkd-route.c
index 0ab4419eba9e8af58013ed97d21543e5751cf8af..b6c19223b67823b223043297fb05fc2468c14cfb 100644 (file)
@@ -110,6 +110,7 @@ int manager_get_route_table_from_string(const Manager *m, const char *s, uint32_
 int manager_get_route_table_to_string(const Manager *m, uint32_t table, char **ret) {
         _cleanup_free_ char *str = NULL;
         const char *s;
+        int r;
 
         assert(m);
         assert(ret);
@@ -121,17 +122,13 @@ int manager_get_route_table_to_string(const Manager *m, uint32_t table, char **r
         if (!s)
                 s = hashmap_get(m->route_table_names_by_number, UINT32_TO_PTR(table));
 
-        if (s) {
+        if (s)
                 /* Currently, this is only used in debugging logs. To not confuse any bug
                  * reports, let's include the table number. */
-                if (asprintf(&str, "%s(%" PRIu32 ")", s, table) < 0)
-                        return -ENOMEM;
-
-                *ret = TAKE_PTR(str);
-                return 0;
-        }
-
-        if (asprintf(&str, "%" PRIu32, table) < 0)
+                r = asprintf(&str, "%s(%" PRIu32 ")", s, table);
+        else
+                r = asprintf(&str, "%" PRIu32, table);
+        if (r < 0)
                 return -ENOMEM;
 
         *ret = TAKE_PTR(str);