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.
This commit is contained in:
Andreas Schwab 2023-12-06 14:48:22 +01:00
parent 4b00532e51
commit 5eabdb6a6a

View File

@ -615,7 +615,14 @@ get_nss_addresses (const char *name, const struct addrinfo *req,
function variant. */ function variant. */
res_ctx = __resolv_context_get (); res_ctx = __resolv_context_get ();
if (res_ctx == NULL) if (res_ctx == NULL)
no_more = 1; {
if (errno == ENOMEM)
{
result = -EAI_MEMORY;
goto out;
}
no_more = 1;
}
while (!no_more) while (!no_more)
{ {