1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

Fixed data type casts to address endianness issues on ia64

This commit is contained in:
Daniel P. Berrange 2007-02-19 15:01:20 +00:00
parent cfa655f9b8
commit 10041b979d
3 changed files with 22 additions and 9 deletions

View File

@ -1,3 +1,9 @@
Mon Feb 19 09:38:24 EST 2007 Daniel P. Berrange <berrange@redhat.com>
* qemud/bridge.c, qemud/conf.c: Fixed int -> char casts to deal
with endianness / alignment issues on IA64 platforms. Patch
from Atsushi SAKAI <sakaia@jp.fujitsu.com>
Fri Feb 16 18:28:32 IST 2007 Mark McLoughlin <markmc@redhat.com>
* qemud/qemud.c, qemud/dispatch.c, qemud/internal.h

View File

@ -349,8 +349,8 @@ brSetInetAddr(brControl *ctl,
else if (ret == 0)
return EINVAL;
((struct sockaddr_in *)&ifr.ifr_addr)->sin_family = AF_INET;
((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr = inaddr;
((struct sockaddr_in *)((void *)&ifr.ifr_addr))->sin_family = AF_INET;
((struct sockaddr_in *)((void *)&ifr.ifr_addr))->sin_addr = inaddr;
if (ioctl(ctl->fd, cmd, &ifr) < 0)
return errno;
@ -386,7 +386,7 @@ brGetInetAddr(brControl *ctl,
if (maxlen < BR_INET_ADDR_MAXLEN || ifr.ifr_addr.sa_family != AF_INET)
return EFAULT;
inaddr = &((struct sockaddr_in *)&ifr.ifr_addr)->sin_addr;
inaddr = &((struct sockaddr_in *)((void *)&ifr.ifr_addr))->sin_addr;
if (!inet_ntop(AF_INET, inaddr, addr, maxlen))
return errno;

View File

@ -447,13 +447,20 @@ static struct qemud_vm_net_def *qemudParseInterfaceXML(struct qemud_server *serv
net->vlan = 0;
if (macaddr) {
unsigned int mac[6];
sscanf((const char *)macaddr, "%02x:%02x:%02x:%02x:%02x:%02x",
(unsigned int*)&net->mac[0],
(unsigned int*)&net->mac[1],
(unsigned int*)&net->mac[2],
(unsigned int*)&net->mac[3],
(unsigned int*)&net->mac[4],
(unsigned int*)&net->mac[5]);
(unsigned int*)&mac[0],
(unsigned int*)&mac[1],
(unsigned int*)&mac[2],
(unsigned int*)&mac[3],
(unsigned int*)&mac[4],
(unsigned int*)&mac[5]);
net->mac[0] = mac[0];
net->mac[1] = mac[1];
net->mac[2] = mac[2];
net->mac[3] = mac[3];
net->mac[4] = mac[4];
net->mac[5] = mac[5];
xmlFree(macaddr);
}