Chromium Code Reviews| Index: native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
| diff --git a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
| index b0a3f243a67833422d756bf2ce7d89b30210f948..fd604a4a70776dad45b086b3da136e30b74e94f4 100644 |
| --- a/native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
| +++ b/native_client_sdk/src/libraries/nacl_io/host_resolver.cc |
| @@ -196,6 +196,11 @@ struct hostent* HostResolver::gethostbyname(const char* name) { |
| } |
| freeaddrinfo(ai); |
| + |
| + // Copy element zero of h_addr_list to h_addr as in some libc's h_addr may be |
| + // a macro, but in others it may be a separate member. |
| + hostent_.haddr = hostent_.h_addr_list[0]; |
|
Sam Clegg
2014/05/07 23:20:15
With the compiler not warn about self-assignment h
|
| + |
| return &hostent_; |
| } |
| @@ -416,6 +421,7 @@ void HostResolver::hostent_cleanup() { |
| hostent_.h_name = NULL; |
| hostent_.h_aliases = NULL; |
| hostent_.h_addr_list = NULL; |
| + hostent_.h_addr = NULL; |
| } |
| } // namespace nacl_io |