Instead of accessing ss_family, cast sockaddr_storage to sockaddr and access sa_family.

This commit is contained in:
Martin v. Löwis 2001-07-23 01:30:10 +00:00
parent b5c61a899e
commit 9db2f571c3
3 changed files with 335 additions and 335 deletions

View File

@ -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

662
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -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