am 871fb863: am 6823cbe5: am 7602628e: Merge "Add error-check when mapping socket to fd"

* commit '871fb8630991765caa800ee6061df875fce42e9e':
  Add error-check when mapping socket to fd
This commit is contained in:
Elliott Hughes 2014-11-27 19:39:13 +00:00 committed by Android Git Automerger
commit 964c49f505

View File

@ -463,6 +463,15 @@ android_getaddrinfo_proxy(
// Send the request.
proxy = fdopen(sock, "r+");
if (proxy == NULL) {
// Failed to map sock to FILE*. Check errno for the cause.
// @sonymobile.com saw failures in automated testing, but
// couldn't reproduce it for debugging.
// Fail with EAI_SYSTEM and let callers handle the failure.
close(sock);
return EAI_SYSTEM;
}
if (fprintf(proxy, "getaddrinfo %s %s %d %d %d %d %u",
hostname == NULL ? "^" : hostname,
servname == NULL ? "^" : servname,