Commit 861a65bc authored by Martin v. Löwis's avatar Martin v. Löwis

Include netdb.h to detect getaddrinfo. Work around problem with getaddrinfo

not properly processing numeric IPv4 addresses. Fixes V5.1 part of #472675.
parent 6bc55c43
......@@ -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;
......
This diff is collapsed.
......@@ -1426,7 +1426,17 @@ AC_CHECK_FUNCS(getpgrp, AC_TRY_COMPILE([#include <unistd.h>], [getpgrp(0);], AC_
AC_CHECK_FUNCS(setpgrp, AC_TRY_COMPILE([#include <unistd.h>], [setpgrp(0,0);], AC_DEFINE(SETPGRP_HAVE_ARG)))
AC_CHECK_FUNCS(gettimeofday, AC_TRY_COMPILE([#include <sys/time.h>], [gettimeofday((struct timeval*)0,(struct timezone*)0);], ,AC_DEFINE(GETTIMEOFDAY_NO_TZ)))
AC_CHECK_FUNCS(getaddrinfo, [dnl
# On OSF/1 V5.1, getaddrinfo is available, but a define
# for [no]getaddrinfo in netdb.h.
AC_MSG_CHECKING(for getaddrinfo)
AC_TRY_LINK([
#include <sys/socket.h>
#include <netdb.h>
],[
getaddrinfo(NULL, NULL, NULL, NULL);
], [
AC_MSG_RESULT(yes)
AC_MSG_CHECKING(getaddrinfo bug)
AC_TRY_RUN([
#include <sys/types.h>
......@@ -1519,7 +1529,10 @@ buggygetaddrinfo=no,
AC_MSG_RESULT(buggy)
buggygetaddrinfo=yes,
AC_MSG_RESULT(buggy)
buggygetaddrinfo=yes)], [buggygetaddrinfo=yes])
buggygetaddrinfo=yes)], [
AC_MSG_RESULT(no)
buggygetaddrinfo=yes
])
if test "$buggygetaddrinfo" = "yes"; then
if test "$ipv6" = "yes"; then
......@@ -1527,6 +1540,8 @@ if test "$buggygetaddrinfo" = "yes"; then
echo ' or you can specify "--disable-ipv6"'.
exit 1
fi
else
AC_DEFINE(HAVE_GETADDRINFO)
fi
AC_CHECK_FUNCS(getnameinfo)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment