From cc4544ef8069a14c67a46b7e8e28eff1dc102050 Mon Sep 17 00:00:00 2001 From: Siddhesh Poyarekar Date: Wed, 2 Mar 2022 11:45:29 +0530 Subject: 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 Reviewed-by: DJ Delorie (cherry picked from commit b587456c0e7b59dcfdbd2d44db000a3bc8244e57) --- sysdeps/posix/getaddrinfo.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sysdeps/posix/getaddrinfo.c b/sysdeps/posix/getaddrinfo.c index 1008f24736..37260d6e6f 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; } } -- cgit v1.2.3