about summary refs log tree commit diff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2023-12-06 14:48:22 +0100
committerAndreas Schwab <schwab@suse.de>2024-01-02 11:10:42 +0100
commit5eabdb6a6ac1599d23dd5966a37417215950245f (patch)
treeb2884c59b1613e45ec124fd1e5234f49dde86013
parent4b00532e51e40e2a85eba65ed817234b7bd741d9 (diff)
downloadglibc-5eabdb6a6ac1599d23dd5966a37417215950245f.tar.gz
glibc-5eabdb6a6ac1599d23dd5966a37417215950245f.tar.xz
glibc-5eabdb6a6ac1599d23dd5966a37417215950245f.zip
getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163)
When __resolv_context_get returns NULL due to out of memory, translate it
to a return value of EAI_MEMORY.
-rw-r--r--nss/getaddrinfo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/nss/getaddrinfo.c b/nss/getaddrinfo.c
index a225f9b0fd..3ccd3905fa 100644
--- a/nss/getaddrinfo.c
+++ b/nss/getaddrinfo.c
@@ -615,7 +615,14 @@ get_nss_addresses (const char *name, const struct addrinfo *req,
      function variant.  */
   res_ctx = __resolv_context_get ();
   if (res_ctx == NULL)
-    no_more = 1;
+    {
+      if (errno == ENOMEM)
+	{
+	  result = -EAI_MEMORY;
+	  goto out;
+	}
+      no_more = 1;
+    }
 
   while (!no_more)
     {