diff options
Diffstat (limited to 'networking/libiproute/utils.c')
-rw-r--r-- | networking/libiproute/utils.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/networking/libiproute/utils.c b/networking/libiproute/utils.c index 7f7cb4203..42025bc66 100644 --- a/networking/libiproute/utils.c +++ b/networking/libiproute/utils.c | |||
@@ -276,20 +276,21 @@ int inet_addr_match(const inet_prefix *a, const inet_prefix *b, int bits) | |||
276 | return 0; | 276 | return 0; |
277 | } | 277 | } |
278 | 278 | ||
279 | const char *rt_addr_n2a(int af, | 279 | const char *rt_addr_n2a(int af, void *addr) |
280 | void *addr, char *buf, int buflen) | ||
281 | { | 280 | { |
282 | switch (af) { | 281 | switch (af) { |
283 | case AF_INET: | 282 | case AF_INET: |
284 | case AF_INET6: | 283 | case AF_INET6: |
285 | return inet_ntop(af, addr, buf, buflen); | 284 | return inet_ntop(af, addr, |
285 | auto_string(xzalloc(INET6_ADDRSTRLEN)), INET6_ADDRSTRLEN | ||
286 | ); | ||
286 | default: | 287 | default: |
287 | return "???"; | 288 | return "???"; |
288 | } | 289 | } |
289 | } | 290 | } |
290 | 291 | ||
291 | #ifdef RESOLVE_HOSTNAMES | 292 | #ifdef RESOLVE_HOSTNAMES |
292 | const char *format_host(int af, int len, void *addr, char *buf, int buflen) | 293 | const char *format_host(int af, int len, void *addr) |
293 | { | 294 | { |
294 | if (resolve_hosts) { | 295 | if (resolve_hosts) { |
295 | struct hostent *h_ent; | 296 | struct hostent *h_ent; |
@@ -308,11 +309,10 @@ const char *format_host(int af, int len, void *addr, char *buf, int buflen) | |||
308 | if (len > 0) { | 309 | if (len > 0) { |
309 | h_ent = gethostbyaddr(addr, len, af); | 310 | h_ent = gethostbyaddr(addr, len, af); |
310 | if (h_ent != NULL) { | 311 | if (h_ent != NULL) { |
311 | safe_strncpy(buf, h_ent->h_name, buflen); | 312 | return auto_string(xstrdup(h_ent->h_name)); |
312 | return buf; | ||
313 | } | 313 | } |
314 | } | 314 | } |
315 | } | 315 | } |
316 | return rt_addr_n2a(af, addr, buf, buflen); | 316 | return rt_addr_n2a(af, addr); |
317 | } | 317 | } |
318 | #endif | 318 | #endif |