Commit e8a13c44 authored by Bruno Bigras's avatar Bruno Bigras

Fix a strict-aliasing with type-punning

Fixes #880
parent b54a168d
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment