[cpp-sp COMMIT] /branches/REL_2/shibsp/remoting/impl/TCPListener.cpp

noreply at shibboleth.net noreply at shibboleth.net
Thu May 3 23:27:17 BST 2012


Author: scantor
Date: Thu May  3 23:27:16 2012
New Revision: 3642

URL: http://svn.shibboleth.net/view/cpp-sp?rev=3642&view=rev
Log:
Apply BSD fix to connect call

Modified:
    branches/REL_2/shibsp/remoting/impl/TCPListener.cpp

Modified: branches/REL_2/shibsp/remoting/impl/TCPListener.cpp
URL: http://svn.shibboleth.net/view/cpp-sp/branches/REL_2/shibsp/remoting/impl/TCPListener.cpp?rev=3642&r1=3641&r2=3642&view=diff
==============================================================================
--- branches/REL_2/shibsp/remoting/impl/TCPListener.cpp (original)
+++ branches/REL_2/shibsp/remoting/impl/TCPListener.cpp Thu May  3 23:27:16 2012
@@ -232,7 +232,17 @@
     if(SOCKET_ERROR==::connect(s, (const struct sockaddr*)&m_sockaddr, sizeof(m_sockaddr)))
         return log_error("connect");
 #else
+    // Newer BSDs require the struct length be passed based on the socket address.
+    // Others have no field for that and take the whole struct size like Windows does.
+# ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+#  ifdef HAVE_STRUCT_SOCKADDR_STORAGE
+    if (::connect(s, (const struct sockaddr*)&m_sockaddr, m_sockaddr.ss_len) < 0)
+#  else
+    if (::connect(s, (const struct sockaddr*)&m_sockaddr, m_sockaddr.sin_len) < 0)
+#  endif
+# else
     if (::connect(s, (const struct sockaddr*)&m_sockaddr, sizeof(m_sockaddr)) < 0)
+# endif
         return log_error("connect");
 #endif
     return true;



More information about the commits mailing list