0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-16 12:16:33 +08:00

Fix a strict-aliasing with type-punning

Fixes #880
This commit is contained in:
Bruno Bigras 2014-02-13 12:06:10 -05:00
parent b54a168d41
commit e8a13c44b0

View File

@ -145,7 +145,14 @@ int zmq::get_peer_ip_address (fd_t sockfd_, std::string &ip_addr_)
return 0;
ip_addr_ = host;
return (int) ((struct sockaddr *) &ss)->sa_family;
union {
struct sockaddr sa;
struct sockaddr_storage sa_stor;
} u;
u.sa_stor = ss;
return (int) u.sa.sa_family;
}
void zmq::set_ip_type_of_service (fd_t s_, int iptos)