]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163)
authorAndreas Schwab <schwab@suse.de>
Wed, 6 Dec 2023 13:48:22 +0000 (14:48 +0100)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 2 Jan 2024 13:37:02 +0000 (14:37 +0100)
When __resolv_context_get returns NULL due to out of memory, translate it
to a return value of EAI_MEMORY.

(cherry picked from commit 5eabdb6a6ac1599d23dd5966a37417215950245f)

sysdeps/posix/getaddrinfo.c

index 13082305d3f89316ae9d685857470835c747f895..da573bea2427981fbc19636ab21c36b884638f69 100644 (file)
@@ -616,7 +616,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)
     {