From: Andreas Schwab Date: Wed, 6 Dec 2023 13:48:22 +0000 (+0100) Subject: getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163) X-Git-Tag: glibc-2.39~143 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5eabdb6a6ac1599d23dd5966a37417215950245f;p=thirdparty%2Fglibc.git 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. --- diff --git a/nss/getaddrinfo.c b/nss/getaddrinfo.c index a225f9b0fd4..3ccd3905fa0 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) {