getaddrinfo: translate ENOMEM to EAI_MEMORY (bug 31163)
Checks
Context |
Check |
Description |
redhat-pt-bot/TryBot-apply_patch |
success
|
Patch applied to master at the time it was sent
|
redhat-pt-bot/TryBot-32bit |
success
|
Build for i686
|
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_glibc_check--master-arm |
success
|
Testing passed
|
Commit Message
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(-)
Comments
* 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
@@ -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)
{