Message ID | mvmsf46ozhp.fsf@suse.de |
---|---|
State | New |
Headers | show |
Series | getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163) | expand |
* Andreas Schwab: > When __resolv_context_get returns NULL due to out of memory, translate it > to a return value of EAI_MEMORY. > --- > nss/getaddrinfo.c | 9 ++++++++- > 1 file changed, 8 insertions(+), 1 deletion(-) > > diff --git a/nss/getaddrinfo.c b/nss/getaddrinfo.c > index 6902a47224..b1cb4d7006 100644 > --- a/nss/getaddrinfo.c > +++ b/nss/getaddrinfo.c > @@ -616,7 +616,14 @@ get_nss_addresses (const char *name, const struct addrinfo *req, > function variant. */ > res_ctx = __resolv_context_get (); > if (res_ctx == NULL) > - no_more = 1; > + { > + if (errno == ENOMEM) > + { > + result = -EAI_MEMORY; > + goto out; > + } > + no_more = 1; > + } Looks good, thanks. Reviewed-by: Florian Weimer <fweimer@redhat.com> Florian
diff --git a/nss/getaddrinfo.c b/nss/getaddrinfo.c index 6902a47224..b1cb4d7006 100644 --- a/nss/getaddrinfo.c +++ b/nss/getaddrinfo.c @@ -616,7 +616,14 @@ get_nss_addresses (const char *name, const struct addrinfo *req, function variant. */ res_ctx = __resolv_context_get (); if (res_ctx == NULL) - no_more = 1; + { + if (errno == ENOMEM) + { + result = -EAI_MEMORY; + goto out; + } + no_more = 1; + } while (!no_more) {