Commit d7ba51de authored by Harald Sitter's avatar Harald Sitter 🏳🌈
Browse files

fix var name in sa_len branch

s/buf/hostOut

also line break the two conditional branches the same way so it's easier
to spot that kinda thing. looking back I wonder if perhaps we should
just stop using sa_len, would certainly avoid this ifdef.

should fix building on freebsd
parent 4582053b
......@@ -134,14 +134,18 @@ static QString HWaddr2String(const char *hwaddr) {
static int getNameInfo(struct sockaddr *addr, struct ifaddrs *ifa, char *hostOut)
{
#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
return getnameinfo(addr, ifa->ifa_addr->sa_len, buf, 127, 0, 0, NI_NUMERICHOST);
return getnameinfo(addr,
ifa->ifa_addr->sa_len,
hostOut, 127,
nullptr, 0,
NI_NUMERICHOST);
#else
return getnameinfo(addr,
(ifa->ifa_addr->sa_family == AF_INET) ? sizeof(struct sockaddr_in) :
sizeof(struct sockaddr_in6),
hostOut, NI_MAXHOST,
nullptr, 0,
NI_NUMERICHOST);
(ifa->ifa_addr->sa_family == AF_INET) ? sizeof(struct sockaddr_in) :
sizeof(struct sockaddr_in6),
hostOut, NI_MAXHOST,
nullptr, 0,
NI_NUMERICHOST);
#endif
}
......
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