util: introduce format_ifname()

This commit is contained in:
Yu Watanabe
2019-05-29 14:21:19 +09:00
parent 658e910640
commit 7f686722f7
3 changed files with 14 additions and 0 deletions
+10
View File
@@ -0,0 +1,10 @@
/* SPDX-License-Identifier: LGPL-2.1+ */
#include "format-util.h"
#include "memory-util.h"
char *format_ifname(int ifindex, char buf[static IF_NAMESIZE + 1]) {
/* Buffer is always cleared */
memzero(buf, IF_NAMESIZE + 1);
return if_indextoname(ifindex, buf);
}