summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-10-24 14:36:00 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-10-24 14:36:00 (GMT)
commit861a65bc2fa83485bdc66f86cb13d4ad4798a68d (patch)
treed1ba7aa34ade87665af8710c19388945b613e9b6 /Modules
parent6bc55c435ac398a4a6bc5c21e4b85a1bfd289a54 (diff)
downloadcpython-861a65bc2fa83485bdc66f86cb13d4ad4798a68d.zip
cpython-861a65bc2fa83485bdc66f86cb13d4ad4798a68d.tar.gz
cpython-861a65bc2fa83485bdc66f86cb13d4ad4798a68d.tar.bz2
Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfo
not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/socketmodule.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index e9ad333..f700e9c 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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;