提交 10041b97 编写于 作者: D Daniel P. Berrange

Fixed data type casts to address endianness issues on ia64

上级 cfa655f9
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
......
......@@ -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;
......
......@@ -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);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册