提交 2b2dae81 编写于 作者: D Daniel Veillard

Avoid an type-punned pointer aliasing pbm

Fix this warning, there is no need to use an intermediate,
different array pointer.
network.c: In function 'getIPv6Addr':
network.c:50: warning: dereferencing type-punned pointer will break strict-aliasing rules
* src/util/network.c: avoid an intermediary pointer cast
上级 421d9950
......@@ -41,16 +41,13 @@ static int getIPv4Addr(virSocketAddrPtr addr, virIPv4AddrPtr tab) {
}
static int getIPv6Addr(virSocketAddrPtr addr, virIPv6AddrPtr tab) {
virIPv6AddrPtr val;
int i;
if ((addr == NULL) || (tab == NULL) || (addr->stor.ss_family != AF_INET6))
return(-1);
val = (virIPv6AddrPtr) &(addr->inet6.sin6_addr.s6_addr16);
for (i = 0;i < 8;i++) {
(*tab)[i] = ntohs((*val)[i]);
(*tab)[i] = ntohs(addr->inet6.sin6_addr.s6_addr16[i]);
}
return(0);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册