public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Siddhesh Poyarekar <siddhesh@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/siddhesh/gai-cleanup2] gethosts: Return EAI_MEMORY on allocation failure Date: Wed, 2 Mar 2022 06:34:49 +0000 (GMT) [thread overview] Message-ID: <20220302063449.DA5563858D39@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=5cbcab03883ec7421fb59d0c79928e878077802b commit 5cbcab03883ec7421fb59d0c79928e878077802b 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> 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 f790921487..f89169dd33 100644 --- a/sysdeps/posix/getaddrinfo.c +++ b/sysdeps/posix/getaddrinfo.c @@ -326,7 +326,7 @@ gethosts (nss_gethostbyname3_r fct, const int family, const char *name, { if (!convert_hostent_to_gaih_addrtuple (req, family, &th, &addrmem)) { - result = -EAI_SYSTEM; + result = -EAI_MEMORY; goto out; } if (addrmem && !gaih_lookup_result_push_alloc (res, addrmem)) @@ -339,7 +339,7 @@ gethosts (nss_gethostbyname3_r fct, const int family, const char *name, char *canonbuf = __strdup (localcanon); if (canonbuf == NULL) { - result = -EAI_SYSTEM; + result = -EAI_MEMORY; goto out; } *canonp = canonbuf;
next reply other threads:[~2022-03-02 6:34 UTC|newest] Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-03-02 6:34 Siddhesh Poyarekar [this message] 2022-03-07 16:56 Siddhesh Poyarekar 2022-03-08 14:10 Siddhesh Poyarekar 2022-03-14 14:17 Siddhesh Poyarekar
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220302063449.DA5563858D39@sourceware.org \ --to=siddhesh@sourceware.org \ --cc=glibc-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).