getaddrinfo: Return EAI_NODATA if gethostbyname2_r reports NO_DATA [BZ #21922]

(cherry picked from commit 5f8340f583fe3d4f5734bd2371c5a45ecff2db0d)
This commit is contained in:
Florian Weimer 2017-09-04 11:25:34 +02:00
parent 7ab87bccb6
commit 7966331555
3 changed files with 15 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2017-09-01 Florian Weimer <fweimer@redhat.com>
[BZ #21922]
* sysdeps/posix/getaddrinfo.c (gaih_inet): Report EAI_NODATA error
coming from gethostbyname2_r.
2017-09-01 Florian Weimer <fweimer@redhat.com>
* sysdeps/posix/getaddrinfo.c (gaih_inet): Only use h_errno if

1
NEWS
View File

@ -22,6 +22,7 @@ The following bugs are resolved with this release:
[21780] posix: Set p{read,write}v2 to return ENOTSUP
[21871] x86-64: Use _dl_runtime_resolve_opt only with AVX512F
[21885] getaddrinfo: Release resolver context on error in gethosts
[21922] getaddrinfo with AF_INET(6) returns EAI_NONAME, not EAI_NODATA
[21930] Do not use __builtin_types_compatible_p in C++ mode
[21932] Unpaired __resolv_context_get in generic get*_r implementation
[21941] powerpc: Restrict xssqrtqp operands to Vector Registers

View File

@ -619,6 +619,14 @@ gaih_inet (const char *name, const struct gaih_service *service,
}
*pat = addrmem;
}
else
{
if (h_errno == NO_DATA)
result = -EAI_NODATA;
else
result = -EAI_NONAME;
goto free_and_return;
}
}
else
{