Instead of accessing ss_family, cast sockaddr_storage to sockaddr and access sa_family.
This commit is contained in:
parent
b5c61a899e
commit
9db2f571c3
|
@ -1894,6 +1894,7 @@ PySocket_gethostbyname_ex(PyObject *self, PyObject *args)
|
|||
char *name;
|
||||
struct hostent *h;
|
||||
struct sockaddr_storage addr;
|
||||
struct sockaddr *sa;
|
||||
PyObject *ret;
|
||||
#ifdef HAVE_GETHOSTBYNAME_R
|
||||
struct hostent hp_allocated;
|
||||
|
@ -1931,7 +1932,10 @@ PySocket_gethostbyname_ex(PyObject *self, PyObject *args)
|
|||
h = gethostbyname(name);
|
||||
#endif /* HAVE_GETHOSTBYNAME_R */
|
||||
Py_END_ALLOW_THREADS
|
||||
ret = gethost_common(h, (struct sockaddr *)&addr, sizeof(addr), addr.ss_family);
|
||||
/* Some C libraries would require addr.__ss_family instead of addr.ss_family.
|
||||
Therefore, we cast the sockaddr_storage into sockaddr to access sa_family. */
|
||||
sa = (struct sockaddr*)&addr;
|
||||
ret = gethost_common(h, (struct sockaddr *)&addr, sizeof(addr), sa->sa_family);
|
||||
#ifdef USE_GETHOSTBYNAME_LOCK
|
||||
PyThread_release_lock(gethostbyname_lock);
|
||||
#endif
|
||||
|
|
|
@ -374,8 +374,6 @@ else
|
|||
fi
|
||||
|
||||
# Check for enable-ipv6
|
||||
# XXX definition of ss_family disabled until author clarifies rationale.
|
||||
# DEFS="$DEFS -Dss_family=__ss_family -Dss_len=__ss_len"
|
||||
AC_MSG_CHECKING([whether to enable ipv6])
|
||||
AC_ARG_ENABLE(ipv6,
|
||||
[ --enable-ipv6 Enable ipv6 (with ipv4) support
|
||||
|
|
Loading…
Reference in New Issue