aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndreas Schwab <schwab@suse.de>2023-12-06 14:48:22 +0100
committerAndreas K. Hüttel <dilfridge@gentoo.org>2024-01-30 19:12:17 +0100
commit67f31cb19badf11997a11c8b42ca45e3c3bd1bfc (patch)
tree03aa34e2dfdc4691ad7517debb377cbf68a11878
parentGentoo: Disable valgrind-based tests, too unreliable (diff)
downloadglibc-67f31cb19badf11997a11c8b42ca45e3c3bd1bfc.tar.gz
glibc-67f31cb19badf11997a11c8b42ca45e3c3bd1bfc.tar.bz2
glibc-67f31cb19badf11997a11c8b42ca45e3c3bd1bfc.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. (cherry picked from commit 5eabdb6a6ac1599d23dd5966a37417215950245f) (cherry picked from commit ae1e5217021e43e1f2de443d26e87ea3adfb221c)
-rw-r--r--sysdeps/posix/getaddrinfo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index 13082305d3..da573bea24 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -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)
{