summary refs log tree commit diff
path: root/sysdeps/posix
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2017-09-01 08:57:52 +0200
committerFlorian Weimer <fweimer@redhat.com>2017-09-01 08:57:52 +0200
commita2881ef01450295782b065f2f850f340d5c12c14 (patch)
tree7abcbf2374defb0b0d3c7b0ad5613b99d2406cf4 /sysdeps/posix
parentad816a5e00ce891a2cea8187638fa0e00f83aaf6 (diff)
downloadglibc-a2881ef01450295782b065f2f850f340d5c12c14.tar.gz
glibc-a2881ef01450295782b065f2f850f340d5c12c14.tar.xz
glibc-a2881ef01450295782b065f2f850f340d5c12c14.zip
getaddrinfo: In gaih_inet, use h_errno for certain status values only
h_errno is not set for NSS_STATUS_SUCCESS, so its value might not be
accurate at this point.
Diffstat (limited to 'sysdeps/posix')
-rw-r--r--sysdeps/posix/getaddrinfo.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 95b514873d..acb5d9e73d 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -948,7 +948,10 @@ gaih_inet (const char *name, const struct gaih_service *service,
 	  __resolv_context_enable_inet6 (res_ctx, res_enable_inet6);
 	  __resolv_context_put (res_ctx);
 
-	  if (h_errno == NETDB_INTERNAL)
+	  /* If we have a failure which sets errno, report it using
+	     EAI_SYSTEM.  */
+	  if ((status == NSS_STATUS_TRYAGAIN || status == NSS_STATUS_UNAVAIL)
+	      && h_errno == NETDB_INTERNAL)
 	    {
 	      result = -EAI_SYSTEM;
 	      goto free_and_return;