mirror of
https://github.com/python/cpython.git
synced 2025-08-30 13:38:43 +00:00
Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfo
not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
This commit is contained in:
parent
6bc55c435a
commit
861a65bc2f
3 changed files with 361 additions and 369 deletions
|
@ -622,6 +622,12 @@ setipaddr(char* name, struct sockaddr * addr_ret, int af)
|
|||
memset(&hints, 0, sizeof(hints));
|
||||
hints.ai_family = af;
|
||||
error = getaddrinfo(name, NULL, &hints, &res);
|
||||
if (error = EAI_NONAME && af == AF_UNSPEC) {
|
||||
/* On OSF/1 V5.1, numeric-to-addr conversion
|
||||
fails if no address family is given. Assume IPv4 for now.*/
|
||||
hints.ai_family = AF_INET;
|
||||
error = getaddrinfo(name, NULL, &hints, &res);
|
||||
}
|
||||
if (error) {
|
||||
PyGAI_Err(error);
|
||||
return -1;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue