1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-24 20:30:28 +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:12:52 +00:00
parent 26fa7d2910
commit 1155d5ebe2

View file

@ -704,9 +704,7 @@ scm_fill_sockaddr (int fam, SCM address, SCM *args, int which_arg,
soka = (struct sockaddr_in *) malloc (sizeof (struct sockaddr_in)); soka = (struct sockaddr_in *) 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;
@ -742,7 +740,7 @@ scm_fill_sockaddr (int fam, SCM address, SCM *args, int which_arg,
soka = (struct sockaddr_in6 *) malloc (sizeof (struct sockaddr_in6)); soka = (struct sockaddr_in6 *) 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;