diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-29 07:18:41 +0200 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2019-05-29 07:21:19 +0200 |
commit | 518a66ec082d977b753acaca289e1a2bd9278f6b (patch) | |
tree | 8d16e76b3c2967cfd42446185f6c5e236a0f7c46 /src/test/test-nss.c | |
parent | util: introduce format_ifname() (diff) | |
download | systemd-518a66ec082d977b753acaca289e1a2bd9278f6b.tar.xz systemd-518a66ec082d977b753acaca289e1a2bd9278f6b.zip |
tree-wide: replace if_indextoname() with format_ifname()
Diffstat (limited to 'src/test/test-nss.c')
-rw-r--r-- | src/test/test-nss.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/test/test-nss.c b/src/test/test-nss.c index d0f9898378..6ba0f6887e 100644 --- a/src/test/test-nss.c +++ b/src/test/test-nss.c @@ -8,6 +8,7 @@ #include "af-list.h" #include "alloc-util.h" #include "errno-list.h" +#include "format-util.h" #include "hexdecoct.h" #include "hostname-util.h" #include "in-addr-util.h" @@ -77,7 +78,7 @@ static int print_gaih_addrtuples(const struct gaih_addrtuple *tuples) { union in_addr_union u; int r; char family_name[DECIMAL_STR_MAX(int)]; - char ifname[IF_NAMESIZE]; + char ifname[IF_NAMESIZE + 1]; memcpy(&u, it->addr, 16); r = in_addr_to_string(it->family, &u, &a); @@ -88,7 +89,7 @@ static int print_gaih_addrtuples(const struct gaih_addrtuple *tuples) { if (it->scopeid == 0) goto numerical_index; - if (!if_indextoname(it->scopeid, ifname)) { + if (!format_ifname(it->scopeid, ifname)) { log_warning_errno(errno, "if_indextoname(%d) failed: %m", it->scopeid); numerical_index: xsprintf(ifname, "%i", it->scopeid); |