mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
Instead of accessing ss_family, cast sockaddr_storage to sockaddr and access sa_family.
This commit is contained in:
parent
b5c61a899e
commit
9db2f571c3
3 changed files with 335 additions and 335 deletions
|
@ -1894,6 +1894,7 @@ PySocket_gethostbyname_ex(PyObject *self, PyObject *args)
|
||||||
char *name;
|
char *name;
|
||||||
struct hostent *h;
|
struct hostent *h;
|
||||||
struct sockaddr_storage addr;
|
struct sockaddr_storage addr;
|
||||||
|
struct sockaddr *sa;
|
||||||
PyObject *ret;
|
PyObject *ret;
|
||||||
#ifdef HAVE_GETHOSTBYNAME_R
|
#ifdef HAVE_GETHOSTBYNAME_R
|
||||||
struct hostent hp_allocated;
|
struct hostent hp_allocated;
|
||||||
|
@ -1931,7 +1932,10 @@ PySocket_gethostbyname_ex(PyObject *self, PyObject *args)
|
||||||
h = gethostbyname(name);
|
h = gethostbyname(name);
|
||||||
#endif /* HAVE_GETHOSTBYNAME_R */
|
#endif /* HAVE_GETHOSTBYNAME_R */
|
||||||
Py_END_ALLOW_THREADS
|
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
|
#ifdef USE_GETHOSTBYNAME_LOCK
|
||||||
PyThread_release_lock(gethostbyname_lock);
|
PyThread_release_lock(gethostbyname_lock);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -374,8 +374,6 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for enable-ipv6
|
# 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_MSG_CHECKING([whether to enable ipv6])
|
||||||
AC_ARG_ENABLE(ipv6,
|
AC_ARG_ENABLE(ipv6,
|
||||||
[ --enable-ipv6 Enable ipv6 (with ipv4) support
|
[ --enable-ipv6 Enable ipv6 (with ipv4) support
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue