Commit 19bb3b87 authored by Dominik Charousset's avatar Dominik Charousset

Fix conversion warning

parent 3a2db1ce
...@@ -75,10 +75,10 @@ void for_each_device(bool include_localhost, F fun) { ...@@ -75,10 +75,10 @@ void for_each_device(bool include_localhost, F fun) {
if (include_localhost) { if (include_localhost) {
fun(i, family); fun(i, family);
} else if (family == AF_INET || family == AF_INET6) { } else if (family == AF_INET || family == AF_INET6) {
auto ok = getnameinfo(i->ifa_addr, auto len = static_cast<socklen_t>(family == AF_INET
family == AF_INET ? sizeof(sockaddr_in) ? sizeof(sockaddr_in)
: sizeof(sockaddr_in6), : sizeof(sockaddr_in6));
host, NI_MAXHOST, nullptr, 0, 0); auto ok = getnameinfo(i->ifa_addr, len, host, NI_MAXHOST, nullptr, 0, 0);
if (ok == 0 && strcmp("localhost", host) != 0) { if (ok == 0 && strcmp("localhost", host) != 0) {
fun(i, family); fun(i, family);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment