mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-11-05 04:41:20 +00:00
Avoid cast alignment warnings in port allocator test
To avoid virportallocatortest.c: In function 'bind': virportallocatortest.c:34:33: warning: cast increases required alignment of target type [-Wcast-align] struct sockaddr_in *saddr = (struct sockaddr_in *)addr; ^ Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
This commit is contained in:
parent
e57aaa6fcf
commit
2d77704509
@ -31,12 +31,14 @@ int bind(int sockfd ATTRIBUTE_UNUSED,
|
|||||||
const struct sockaddr *addr,
|
const struct sockaddr *addr,
|
||||||
socklen_t addrlen ATTRIBUTE_UNUSED)
|
socklen_t addrlen ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
struct sockaddr_in *saddr = (struct sockaddr_in *)addr;
|
struct sockaddr_in saddr;
|
||||||
|
|
||||||
if (saddr->sin_port == htons(5900) ||
|
memcpy(&saddr, addr, sizeof(saddr));
|
||||||
saddr->sin_port == htons(5904) ||
|
|
||||||
saddr->sin_port == htons(5905) ||
|
if (saddr.sin_port == htons(5900) ||
|
||||||
saddr->sin_port == htons(5906)) {
|
saddr.sin_port == htons(5904) ||
|
||||||
|
saddr.sin_port == htons(5905) ||
|
||||||
|
saddr.sin_port == htons(5906)) {
|
||||||
errno = EADDRINUSE;
|
errno = EADDRINUSE;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user