Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Unified Diff: native_client_sdk/src/libraries/nacl_io/host_resolver.cc

Issue 275533002: Handle h_addr in a more libc independent way. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/host_resolver_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | native_client_sdk/src/tests/nacl_io_test/host_resolver_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698