Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Check sockaddr.sa_len by configure

  • Loading branch information...
commit aae1fca2d8b42cfdf798caccebfcf1a4cb7a8931 1 parent d3ce4b4
@iquiw iquiw authored
Showing with 11 additions and 3 deletions.
  1. +3 −3 Network/Socket.hsc
  2. +8 −0 configure.ac
View
6 Network/Socket.hsc
@@ -501,7 +501,7 @@ pokeSockAddr p (SockAddrUnix path) = do
#if defined(darwin_TARGET_OS)
zeroMemory p (#const sizeof(struct sockaddr_un))
#endif
-#if defined(netbsd_TARGET_OS)
+#if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
(#poke struct sockaddr_un, sun_len) p ((#const sizeof(struct sockaddr_un)) :: Word8)
#endif
(#poke struct sockaddr_un, sun_family) p ((#const AF_UNIX) :: CSaFamily)
@@ -513,7 +513,7 @@ pokeSockAddr p (SockAddrInet (PortNum port) addr) = do
#if defined(darwin_TARGET_OS)
zeroMemory p (#const sizeof(struct sockaddr_in))
#endif
-#if defined(netbsd_TARGET_OS)
+#if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
(#poke struct sockaddr_in, sin_len) p ((#const sizeof(struct sockaddr_in)) :: Word8)
#endif
(#poke struct sockaddr_in, sin_family) p ((#const AF_INET) :: CSaFamily)
@@ -524,7 +524,7 @@ pokeSockAddr p (SockAddrInet6 (PortNum port) flow addr scope) = do
#if defined(darwin_TARGET_OS)
zeroMemory p (#const sizeof(struct sockaddr_in6))
#endif
-#if defined(netbsd_TARGET_OS)
+#if defined(HAVE_STRUCT_SOCKADDR_SA_LEN)
(#poke struct sockaddr_in6, sin6_len) p ((#const sizeof(struct sockaddr_in6)) :: Word8)
#endif
(#poke struct sockaddr_in6, sin6_family) p ((#const AF_INET6) :: CSaFamily)
View
8 configure.ac
@@ -31,6 +31,14 @@ AC_CHECK_MEMBERS([struct msghdr.msg_control, struct msghdr.msg_accrights], [], [
# include <sys/uio.h>
#endif])
+dnl ** check if struct sockaddr contains sa_len
+AC_CHECK_MEMBERS([struct sockaddr.sa_len], [], [], [#if HAVE_SYS_TYPES_H
+# include <sys/types.h>
+#endif
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#endif])
+
dnl --------------------------------------------------
dnl * test for in_addr_t
dnl --------------------------------------------------
Please sign in to comment.
Something went wrong with that request. Please try again.