From 2e8050d7f505731c15f08da8eafb7c7d7cd09d5e Mon Sep 17 00:00:00 2001 From: "Sven M. Hallberg" Date: Fri, 5 Sep 2014 20:33:16 +0200 Subject: [PATCH] get human-readable interface names --- src/iface-windows.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/iface-windows.c b/src/iface-windows.c index e3ca771..9c8eb01 100644 --- a/src/iface-windows.c +++ b/src/iface-windows.c @@ -20,6 +20,7 @@ #include "iface-windows.h" #include "iface.h" +#include // wcstombs #include #include #include @@ -76,6 +77,7 @@ static void ip_adapter_address(CattaInterfaceMonitor *m, IP_ADAPTER_ADDRESSES *p { CattaIfIndex idx; CattaHwInterface *hw; + size_t n; // look up the interface index by LUID if((idx = find_ifindex(m, p->Luid)) < 0) { @@ -99,8 +101,10 @@ static void ip_adapter_address(CattaInterfaceMonitor *m, IP_ADAPTER_ADDRESSES *p (m->server->config.allow_point_to_point || !(p->IfType & IF_TYPE_PPP)); // XXX what about IF_TYPE_TUNNEL? + n = wcstombs(NULL, p->FriendlyName, 0) + 1; catta_free(hw->name); - hw->name = catta_strdup(p->AdapterName); + hw->name = catta_new(char, n); + wcstombs(hw->name, p->FriendlyName, n); hw->mtu = p->Mtu; -- 2.39.5