summaryrefslogtreecommitdiffstats
path: root/src/machine/machinectl.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/machine/machinectl.c')
-rw-r--r--src/machine/machinectl.c9
1 files changed, 2 insertions, 7 deletions
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);