diff options
author | Andreas Schwab <schwab@suse.de> | 2023-12-06 14:48:22 +0100 |
---|---|---|
committer | Florian Weimer <fweimer@redhat.com> | 2024-01-02 14:39:17 +0100 |
commit | 9b90e763dbee9899c5521481db6d4e92772ef526 (patch) | |
tree | 3d8767f15a16d16f1da0a3f108b39977b02a72f0 | |
parent | 0ca9ba3a9e73f3118dafce83e0f0ebba2e247313 (diff) | |
download | glibc-9b90e763dbee9899c5521481db6d4e92772ef526.tar.gz glibc-9b90e763dbee9899c5521481db6d4e92772ef526.tar.xz glibc-9b90e763dbee9899c5521481db6d4e92772ef526.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)
-rw-r--r-- | sysdeps/posix/getaddrinfo.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 69f38bbfb9..8607486798 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) { |