summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-07 11:40:00 +0200
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2021-07-09 11:11:25 +0200
commit7dc7ab311b5ed8734912dba4a28945931edd4e0b (patch)
treeb44632612559ee74e9f1b18501cef8a8e06cc599 /src/network
parentshared/killall: replace one trivial asprintf with xsprintf (diff)
downloadsystemd-7dc7ab311b5ed8734912dba4a28945931edd4e0b.tar.xz
systemd-7dc7ab311b5ed8734912dba4a28945931edd4e0b.zip
networkd: replace one trivial asprintf with xsprintf
Diffstat (limited to 'src/network')
-rw-r--r--src/network/networkd-nexthop.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/network/networkd-nexthop.c b/src/network/networkd-nexthop.c
index a52e5dcb16..87f4ee4b10 100644
--- a/src/network/networkd-nexthop.c
+++ b/src/network/networkd-nexthop.c
@@ -15,6 +15,7 @@
#include "networkd-route.h"
#include "parse-util.h"
#include "set.h"
+#include "stdio-util.h"
#include "string-util.h"
NextHop *nexthop_free(NextHop *nexthop) {
@@ -368,7 +369,7 @@ set_manager:
}
static void log_nexthop_debug(const NextHop *nexthop, uint32_t id, const char *str, const Link *link) {
- _cleanup_free_ char *gw = NULL, *new_id = NULL, *group = NULL;
+ _cleanup_free_ char *gw = NULL, *group = NULL;
struct nexthop_grp *nhg;
assert(nexthop);
@@ -379,8 +380,9 @@ static void log_nexthop_debug(const NextHop *nexthop, uint32_t id, const char *s
if (!DEBUG_LOGGING)
return;
+ char new_id[STRLEN("→") + DECIMAL_STR_MAX(uint32_t)] = "";
if (nexthop->id != id)
- (void) asprintf(&new_id, "→%"PRIu32, id);
+ xsprintf(new_id, "→%"PRIu32, id);
(void) in_addr_to_string(nexthop->family, &nexthop->gw, &gw);
@@ -388,7 +390,7 @@ static void log_nexthop_debug(const NextHop *nexthop, uint32_t id, const char *s
(void) strextendf_with_separator(&group, ",", "%"PRIu32":%"PRIu32, nhg->id, nhg->weight+1);
log_link_debug(link, "%s nexthop: id: %"PRIu32"%s, gw: %s, blackhole: %s, group: %s",
- str, nexthop->id, strempty(new_id), strna(gw), yes_no(nexthop->blackhole), strna(group));
+ str, nexthop->id, new_id, strna(gw), yes_no(nexthop->blackhole), strna(group));
}
static int link_nexthop_remove_handler(sd_netlink *rtnl, sd_netlink_message *m, Link *link) {