]> git.ipfire.org Git - ipfire-2.x.git/blob - src/patches/glibc-2.38/0040-getaddrinfo-translate-ENOMEM-to-EAI_MEMORY-bug-31163.patch
glibc: Import latest patches from upstream
[ipfire-2.x.git] / src / patches / glibc-2.38 / 0040-getaddrinfo-translate-ENOMEM-to-EAI_MEMORY-bug-31163.patch
1 From ae1e5217021e43e1f2de443d26e87ea3adfb221c Mon Sep 17 00:00:00 2001
2 From: Andreas Schwab <schwab@suse.de>
3 Date: Wed, 6 Dec 2023 14:48:22 +0100
4 Subject: [PATCH 40/44] getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163)
5
6 When __resolv_context_get returns NULL due to out of memory, translate it
7 to a return value of EAI_MEMORY.
8
9 (cherry picked from commit 5eabdb6a6ac1599d23dd5966a37417215950245f)
10 ---
11 sysdeps/posix/getaddrinfo.c | 9 ++++++++-
12 1 file changed, 8 insertions(+), 1 deletion(-)
13
14 diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
15 index 13082305d3..da573bea24 100644
16 --- a/sysdeps/posix/getaddrinfo.c
17 +++ b/sysdeps/posix/getaddrinfo.c
18 @@ -616,7 +616,14 @@ get_nss_addresses (const char *name, const struct addrinfo *req,
19 function variant. */
20 res_ctx = __resolv_context_get ();
21 if (res_ctx == NULL)
22 - no_more = 1;
23 + {
24 + if (errno == ENOMEM)
25 + {
26 + result = -EAI_MEMORY;
27 + goto out;
28 + }
29 + no_more = 1;
30 + }
31
32 while (!no_more)
33 {
34 --
35 2.39.2
36