提交 8ae354f4 编写于 作者: E Eric Blake

build: avoid non-portable IPv6 struct member, for MacOS X

* src/util/network.c (getIPv6Addr): Manually join s6_addr bytes,
instead of assuming s6_addr16 shorts.
Reported by Justin Clifton; solution suggested by Bruno Haible.
上级 58ba49ac
......@@ -47,7 +47,8 @@ static int getIPv6Addr(virSocketAddrPtr addr, virIPv6AddrPtr tab) {
return(-1);
for (i = 0;i < 8;i++) {
(*tab)[i] = ntohs(addr->inet6.sin6_addr.s6_addr16[i]);
(*tab)[i] = ((addr->inet6.sin6_addr.s6_addr[2 * i] << 8) |
addr->inet6.sin6_addr.s6_addr[2 * i + 1]);
}
return(0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册