1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 19:50:24 +02:00

(scm_fill_sockaddr): Use HAVE_STRUCT_SOCKADDR_SIN_LEN and

HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN for sockaddr fields, SIN_LEN and
SIN_LEN6 are not defined on all systems.  Reported by Michael Tuexen.
This commit is contained in:
Kevin Ryde 2004-08-27 01:06:50 +00:00
parent e58fdf43e6
commit 93b047f413

View file

@ -734,9 +734,7 @@ scm_fill_sockaddr (int fam, SCM address, SCM *args, int which_arg,
soka = (struct sockaddr_in *) scm_malloc (sizeof (struct sockaddr_in)); soka = (struct sockaddr_in *) scm_malloc (sizeof (struct sockaddr_in));
if (!soka) if (!soka)
scm_memory_error (proc); scm_memory_error (proc);
/* 4.4BSD-style interface includes sin_len member and defines SIN_LEN, #if HAVE_STRUCT_SOCKADDR_SIN_LEN
4.3BSD does not. */
#ifdef SIN_LEN
soka->sin_len = sizeof (struct sockaddr_in); soka->sin_len = sizeof (struct sockaddr_in);
#endif #endif
soka->sin_family = AF_INET; soka->sin_family = AF_INET;
@ -771,7 +769,7 @@ scm_fill_sockaddr (int fam, SCM address, SCM *args, int which_arg,
soka = (struct sockaddr_in6 *) scm_malloc (sizeof (struct sockaddr_in6)); soka = (struct sockaddr_in6 *) scm_malloc (sizeof (struct sockaddr_in6));
if (!soka) if (!soka)
scm_memory_error (proc); scm_memory_error (proc);
#ifdef SIN_LEN6 #if HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
soka->sin6_len = sizeof (struct sockaddr_in6); soka->sin6_len = sizeof (struct sockaddr_in6);
#endif #endif
soka->sin6_family = AF_INET6; soka->sin6_family = AF_INET6;