[SCM] Socket Wrapper Repository - branch master updated

Andreas Schneider asn at samba.org
Tue Jul 29 07:04:32 MDT 2014


The branch, master has been updated
       via  baa8b43 Provide a compatible declaration of CMSG_ALIGN
       via  d9bae3a SO_PROTOCOL is platform-dependent
      from  1fcf872 swrap: fix another discard const warning in swrap_bind()

http://gitweb.samba.org/?p=socket_wrapper.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit baa8b438f76e66531b26a90c02ab11d4e6c09944
Author: Jakub Hrozek <jakub.hrozek at gmail.com>
Date:   Thu Jul 3 23:13:29 2014 +0200

    Provide a compatible declaration of CMSG_ALIGN
    
    Some platforms (like OSX) do support some of the CMGS macros, but don't
    have a CMSG_ALIGN macro of their own.
    
    Signed-off-by: Jakub Hrozek <jakub.hrozek at gmail.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

commit d9bae3a469d4803003711ae282a52d72905068e9
Author: Jakub Hrozek <jakub.hrozek at gmail.com>
Date:   Wed Jul 2 00:01:04 2014 +0200

    SO_PROTOCOL is platform-dependent
    
    SO_PROTOCOL is not defined on all platforms. In particular, OSX doesn't
    include it and so far I haven't found any compatible declaration.
    
    Signed-off-by: Jakub Hrozek <jakub.hrozek at gmail.com>
    Reviewed-by: Andreas Schneider <asn at samba.org>
    Reviewed-by: Michael Adam <obnox at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 src/socket_wrapper.c                 |    5 ++++-
 tests/test_echo_tcp_socket_options.c |   10 +++++++++-
 2 files changed, 13 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/src/socket_wrapper.c b/src/socket_wrapper.c
index 7ee5b64..930ab58 100644
--- a/src/socket_wrapper.c
+++ b/src/socket_wrapper.c
@@ -3169,6 +3169,8 @@ static int swrap_getsockopt(int s, int level, int optname,
 			*(int *)optval = si->family;
 			return 0;
 #endif /* SO_DOMAIN */
+
+#ifdef SO_PROTOCOL
 		case SO_PROTOCOL:
 			if (optval == NULL || optlen == NULL ||
 			    *optlen < (socklen_t)sizeof(int)) {
@@ -3179,6 +3181,7 @@ static int swrap_getsockopt(int s, int level, int optname,
 			*optlen = sizeof(int);
 			*(int *)optval = si->protocol;
 			return 0;
+#endif /* SO_PROTOCOL */
 		case SO_TYPE:
 			if (optval == NULL || optlen == NULL ||
 			    *optlen < (socklen_t)sizeof(int)) {
@@ -3333,7 +3336,7 @@ int ioctl(int s, unsigned long int r, ...)
 # ifdef _ALIGN /* BSD */
 #define CMSG_ALIGN _ALIGN
 # else
-#error NO_CMSG_ALIGN
+#define CMSG_ALIGN(len) (((len) + sizeof(size_t) - 1) & ~(sizeof(size_t) - 1))
 # endif /* _ALIGN */
 #endif /* CMSG_ALIGN */
 
diff --git a/tests/test_echo_tcp_socket_options.c b/tests/test_echo_tcp_socket_options.c
index 023ac72..3da4a95 100644
--- a/tests/test_echo_tcp_socket_options.c
+++ b/tests/test_echo_tcp_socket_options.c
@@ -101,8 +101,10 @@ static void test_sockopt_so(void **state)
 #ifdef SO_DOMAIN
 	int so_domain = -1;
 #endif /* SO_DOMAIN */
+#ifdef SO_PROTOCOL
 	int so_protocol = -1;
 	int so_type = -1;
+#endif /* SO_PROTOCOL */
 	int rc;
 	int s;
 
@@ -135,6 +137,7 @@ static void test_sockopt_so(void **state)
 	assert_int_equal(so_len, sizeof(int));
 #endif /* SO_DOMAIN */
 
+#ifdef SO_PROTOCOL
 	so_len = sizeof(so_protocol);
 	rc = getsockopt(s,
 			SOL_SOCKET,
@@ -154,6 +157,7 @@ static void test_sockopt_so(void **state)
 	assert_return_code(rc, errno);
 	assert_int_equal(so_type, SOCK_STREAM);
 	assert_int_equal(so_len, sizeof(int));
+#endif /* SO_PROTOCOL */
 
 	close(s);
 }
@@ -163,12 +167,14 @@ static void test_sockopt_so6(void **state)
 {
 	struct sockaddr_in6 sin6;
 	socklen_t slen = sizeof(struct sockaddr_in6);
-	socklen_t so_len;
 #ifdef SO_DOMAIN
 	int so_domain = -1;
 #endif /* SO_DOMAIN */
+#ifdef SO_PROTOCOL
+	socklen_t so_len;
 	int so_protocol = -1;
 	int so_type = -1;
+#endif /* SO_PROTOCOL */
 	int rc;
 	int s;
 
@@ -201,6 +207,7 @@ static void test_sockopt_so6(void **state)
 	assert_int_equal(so_len, sizeof(int));
 #endif /* SO_DOMAIN */
 
+#ifdef SO_PROTOCOL
 	so_len = sizeof(so_protocol);
 	rc = getsockopt(s,
 			SOL_SOCKET,
@@ -220,6 +227,7 @@ static void test_sockopt_so6(void **state)
 	assert_return_code(rc, errno);
 	assert_int_equal(so_type, SOCK_STREAM);
 	assert_int_equal(so_len, sizeof(int));
+#endif /* SO_PROTOCOL */
 
 	close(s);
 }


-- 
Socket Wrapper Repository


More information about the samba-cvs mailing list