mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-20 11:40:18 +02:00
Set sockaddr_in.sin_len field when it exists.
* configure.ac: Detect when struct sockaddr_in has a sin_len field. Remove obsolete comment. * libguile/socket.c (scm_to_sockaddr, scm_fill_sockaddr): Set the sin_len field in our struct sockaddr_in when it exists.
This commit is contained in:
parent
e8ab529d57
commit
482d311b39
2 changed files with 6 additions and 5 deletions
|
@ -957,10 +957,7 @@ AC_CHECK_FUNCS(sethostent gethostent endhostent dnl
|
|||
getnetbyaddr getnetbyname dnl
|
||||
inet_lnaof inet_makeaddr inet_netof hstrerror)
|
||||
|
||||
# struct sockaddr field sin_len is only present on BSD systems.
|
||||
# On 4.4BSD apparently a #define SIN_LEN exists, but on other BSD systems
|
||||
# (eg. FreeBSD 4.9) it doesn't and we must use this configure check
|
||||
AC_CHECK_MEMBERS([struct sockaddr.sin_len],,,
|
||||
AC_CHECK_MEMBERS([struct sockaddr_in.sin_len],,,
|
||||
[#ifdef HAVE_SYS_TYPES_H
|
||||
#include <sys/types.h>
|
||||
#endif
|
||||
|
|
|
@ -798,7 +798,7 @@ scm_fill_sockaddr (int fam, SCM address, SCM *args, int which_arg,
|
|||
soka = (struct sockaddr_in *) scm_malloc (sizeof (struct sockaddr_in));
|
||||
memset (soka, '\0', sizeof (struct sockaddr_in));
|
||||
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_SIN_LEN
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
|
||||
soka->sin_len = sizeof (struct sockaddr_in);
|
||||
#endif
|
||||
soka->sin_family = AF_INET;
|
||||
|
@ -1134,6 +1134,10 @@ scm_to_sockaddr (SCM address, size_t *address_size)
|
|||
|
||||
memset (&c_inet, '\0', sizeof (struct sockaddr_in));
|
||||
|
||||
#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
|
||||
c_inet.sin_len = sizeof (struct sockaddr_in);
|
||||
#endif
|
||||
|
||||
c_inet.sin_addr.s_addr =
|
||||
htonl (scm_to_ulong (SCM_SIMPLE_VECTOR_REF (address, 1)));
|
||||
c_inet.sin_port =
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue