MXS-1220: Fix build failure with older GCC
Older GCC versions seem to have a bug where `struct sockaddr_in` pointers cannot be accessed directly and need to be dereferenced first.
This commit is contained in:
@ -229,12 +229,12 @@ static bool host_to_sockaddr(const char* host, uint16_t port, struct sockaddr_st
|
|||||||
if (addr->ss_family == AF_INET)
|
if (addr->ss_family == AF_INET)
|
||||||
{
|
{
|
||||||
struct sockaddr_in *ip = (struct sockaddr_in*)addr;
|
struct sockaddr_in *ip = (struct sockaddr_in*)addr;
|
||||||
ip->sin_port = htons(port);
|
(*ip).sin_port = htons(port);
|
||||||
}
|
}
|
||||||
else if (addr->ss_family == AF_INET6)
|
else if (addr->ss_family == AF_INET6)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 *ip = (struct sockaddr_in6*)addr;
|
struct sockaddr_in6 *ip = (struct sockaddr_in6*)addr;
|
||||||
ip->sin6_port = htons(port);
|
(*ip).sin6_port = htons(port);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user