From 071e522eec2d4f5f29ef929db4bf40af1860fdac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Sat, 4 Jun 2022 17:01:06 +0200 Subject: tree-wide: convert inet_ntop() calls to anonymous-buffer macros --- src/machine/machinectl.c | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) (limited to 'src/machine') diff --git a/src/machine/machinectl.c b/src/machine/machinectl.c index 64233b89c0..ac2a244967 100644 --- a/src/machine/machinectl.c +++ b/src/machine/machinectl.c @@ -192,7 +192,7 @@ static int call_get_addresses( int family; const void *a; size_t sz; - char buf_ifi[DECIMAL_STR_MAX(int) + 2], buffer[MAX(INET6_ADDRSTRLEN, INET_ADDRSTRLEN)]; + char buf_ifi[1 + DECIMAL_STR_MAX(int)] = ""; r = sd_bus_message_read(reply, "i", &family); if (r < 0) @@ -204,13 +204,8 @@ static int call_get_addresses( if (family == AF_INET6 && ifi > 0) xsprintf(buf_ifi, "%%%i", ifi); - else - strcpy(buf_ifi, ""); - if (!strextend(&addresses, - prefix, - inet_ntop(family, a, buffer, sizeof(buffer)), - buf_ifi)) + if (!strextend(&addresses, prefix, IN_ADDR_TO_STRING(family, a), buf_ifi)) return log_oom(); r = sd_bus_message_exit_container(reply); -- cgit v1.2.1