aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSiddhesh Poyarekar <siddhesh@sourceware.org>2022-03-02 11:45:29 +0530
committerSiddhesh Poyarekar <siddhesh@sourceware.org>2023-09-15 18:32:39 -0400
commit1b9087dcec81e2fd5d7c59ae66d04bd2f0bb64ad (patch)
tree8e8a197619f803a07f5699e9c7e5737e2b3e6996
parentf5f88f142ae67d45388fd669947ec23e0af8ea37 (diff)
downloadglibc-1b9087dcec81e2fd5d7c59ae66d04bd2f0bb64ad.tar
glibc-1b9087dcec81e2fd5d7c59ae66d04bd2f0bb64ad.tar.gz
glibc-1b9087dcec81e2fd5d7c59ae66d04bd2f0bb64ad.tar.bz2
glibc-1b9087dcec81e2fd5d7c59ae66d04bd2f0bb64ad.zip
gethosts: Return EAI_MEMORY on allocation failure
All other cases of failures due to lack of memory return EAI_MEMORY, so it seems wrong to return EAI_SYSTEM here. The only reason convert_hostent_to_gaih_addrtuple could fail is on calloc failure. Signed-off-by: Siddhesh Poyarekar <siddhesh@sourceware.org> Reviewed-by: DJ Delorie <dj@redhat.com> (cherry picked from commit b587456c0e7b59dcfdbd2d44db000a3bc8244e57)
-rw-r--r--sysdeps/posix/getaddrinfo.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c
index f5d4a5cfd9..0ece3b46b7 100644
--- a/sysdeps/posix/getaddrinfo.c
+++ b/sysdeps/posix/getaddrinfo.c
@@ -303,13 +303,13 @@ gethosts (nss_gethostbyname3_r fct, int family, const char *name,
else if (status == NSS_STATUS_SUCCESS)
{
if (!convert_hostent_to_gaih_addrtuple (req, family, &th, res))
- return -EAI_SYSTEM;
+ return -EAI_MEMORY;
if (localcanon != NULL && res->canon == NULL)
{
char *canonbuf = __strdup (localcanon);
if (canonbuf == NULL)
- return -EAI_SYSTEM;
+ return -EAI_MEMORY;
res->canon = canonbuf;
}
}