fix bug in zmq::tcp_address_t::resolve_interface() where all resolved interface ip's overwrited by 0.0.0.0

This commit is contained in:
Sergey KHripchenko 2012-04-18 14:06:39 +04:00
parent c77dc98b5c
commit b89a53ee7a

View File

@ -162,7 +162,7 @@ int zmq::tcp_address_t::resolve_nic_name (const char *nic_, bool ipv4only_)
// Get the addresses. // Get the addresses.
ifaddrs* ifa = NULL; ifaddrs* ifa = NULL;
int rc = getifaddrs (&ifa); int rc = getifaddrs (&ifa);
zmq_assert (rc == 0); zmq_assert (rc == 0);
zmq_assert (ifa != NULL); zmq_assert (ifa != NULL);
// Find the corresponding network interface. // Find the corresponding network interface.
@ -252,8 +252,6 @@ int zmq::tcp_address_t::resolve_interface (const char *interface_,
if (rc != 0 && errno != ENODEV) if (rc != 0 && errno != ENODEV)
return rc; return rc;
if (rc == 0) { if (rc == 0) {
zmq_assert (out_addrlen <= sizeof address);
memcpy (&address, out_addr, out_addrlen);
return 0; return 0;
} }