mirror of https://gitee.com/openkylin/libvirt.git
Fix bridge.c warnings with gcc-4.4
bridge.c: In function 'brSetInetAddr': bridge.c:665: error: dereferencing pointer '({anonymous})' does break strict-aliasing rules bridge.c:665: note: initialized from here bridge.c:666: error: dereferencing pointer '({anonymous})' does break strict-aliasing rules bridge.c:666: note: initialized from here Fix qemud.c warnings with gcc-4.4 qemud.c: In function ‘remoteListenTCP’: qemud.c:675: error: dereferencing pointer ‘sa.72’ does break strict-aliasing rules qemud.c:675: note: initialized from here qemud.c:678: error: dereferencing pointer ‘sa.73’ does break strict-aliasing rules qemud.c:678: note: initialized from here
This commit is contained in:
parent
7d2b7ad520
commit
9fec27be49
|
@ -1,3 +1,11 @@
|
|||
Fri Feb 13 19:03:30 IST 2009 Mark McLoughlin <markmc@redhat.com>
|
||||
|
||||
* qemud/qemud.c: fix gcc-4.4 warnings
|
||||
|
||||
Fri Feb 13 19:03:25 IST 2009 Mark McLoughlin <markmc@redhat.com>
|
||||
|
||||
* src/bridge.c: fix gcc-4.4 warnings
|
||||
|
||||
Fri Feb 13 16:50:35 GMT 2009 John Levon <john.levon@sun.com>
|
||||
|
||||
* src/xend_internal.c: xend in 3.3 grew a couple of new options
|
||||
|
|
|
@ -649,9 +649,16 @@ remoteListenTCP (struct qemud_server *server,
|
|||
return -1;
|
||||
|
||||
for (i = 0; i < nfds; ++i) {
|
||||
struct sockaddr_storage sa;
|
||||
union {
|
||||
struct sockaddr_storage sa_stor;
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sa_in;
|
||||
#ifdef AF_INET6
|
||||
struct sockaddr_in6 sa_in6;
|
||||
#endif
|
||||
} s;
|
||||
char ebuf[1024];
|
||||
socklen_t salen = sizeof(sa);
|
||||
socklen_t salen = sizeof(s);
|
||||
|
||||
if (VIR_ALLOC(sock) < 0) {
|
||||
VIR_ERROR(_("remoteListenTCP: calloc: %s"),
|
||||
|
@ -668,14 +675,14 @@ remoteListenTCP (struct qemud_server *server,
|
|||
sock->type = type;
|
||||
sock->auth = auth;
|
||||
|
||||
if (getsockname(sock->fd, (struct sockaddr *)(&sa), &salen) < 0)
|
||||
if (getsockname(sock->fd, &s.sa, &salen) < 0)
|
||||
goto cleanup;
|
||||
|
||||
if (sa.ss_family == AF_INET)
|
||||
sock->port = htons(((struct sockaddr_in*)&sa)->sin_port);
|
||||
if (s.sa.sa_family == AF_INET) {
|
||||
sock->port = htons(s.sa_in.sin_port);
|
||||
#ifdef AF_INET6
|
||||
else if (sa.ss_family == AF_INET6)
|
||||
sock->port = htons(((struct sockaddr_in6*)&sa)->sin6_port);
|
||||
} else if (s.sa.sa_family == AF_INET6)
|
||||
sock->port = htons(s.sa_in6.sin6_port);
|
||||
#endif
|
||||
else
|
||||
sock->port = -1;
|
||||
|
|
10
src/bridge.c
10
src/bridge.c
|
@ -642,6 +642,10 @@ brSetInetAddr(brControl *ctl,
|
|||
int cmd,
|
||||
const char *addr)
|
||||
{
|
||||
union {
|
||||
struct sockaddr sa;
|
||||
struct sockaddr_in sa_in;
|
||||
} s;
|
||||
struct ifreq ifr;
|
||||
struct in_addr inaddr;
|
||||
int len, ret;
|
||||
|
@ -662,8 +666,10 @@ brSetInetAddr(brControl *ctl,
|
|||
else if (ret == 0)
|
||||
return EINVAL;
|
||||
|
||||
((struct sockaddr_in *)&ifr.ifr_data)->sin_family = AF_INET;
|
||||
((struct sockaddr_in *)&ifr.ifr_data)->sin_addr = inaddr;
|
||||
s.sa_in.sin_family = AF_INET;
|
||||
s.sa_in.sin_addr = inaddr;
|
||||
|
||||
ifr.ifr_addr = s.sa;
|
||||
|
||||
if (ioctl(ctl->fd, cmd, &ifr) < 0)
|
||||
return errno;
|
||||
|
|
Loading…
Reference in New Issue