public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc] gethosts: Return EAI_MEMORY on allocation failure
@ 2022-03-22 14:13 Siddhesh Poyarekar
  0 siblings, 0 replies; only message in thread
From: Siddhesh Poyarekar @ 2022-03-22 14:13 UTC (permalink / raw)
  To: glibc-cvs

https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=b587456c0e7b59dcfdbd2d44db000a3bc8244e57

commit b587456c0e7b59dcfdbd2d44db000a3bc8244e57
Author: Siddhesh Poyarekar <siddhesh@sourceware.org>
Date:   Wed Mar 2 11:45:29 2022 +0530

    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>

Diff:
---
 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 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;
 	}
     }


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-22 14:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-22 14:13 [glibc] gethosts: Return EAI_MEMORY on allocation failure Siddhesh Poyarekar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).