diff options
author | Jeremy Allison <jra@samba.org> | 2007-11-02 14:22:19 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-11-02 14:22:19 -0700 |
commit | 638579d75a2aa00836dc4c0c772381b775944b16 (patch) | |
tree | cae85c76d3a104fc305be8e57103421555fba372 /source/lib | |
parent | 6b7ccd3efb05291f3b8779845a3842a09bb9aa07 (diff) | |
download | samba-638579d75a2aa00836dc4c0c772381b775944b16.tar.gz samba-638579d75a2aa00836dc4c0c772381b775944b16.tar.xz samba-638579d75a2aa00836dc4c0c772381b775944b16.zip |
Ensure we use the correct socklen_t values for bind() for
Solaris.
Jeremy.
Diffstat (limited to 'source/lib')
-rw-r--r-- | source/lib/util_sock.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/source/lib/util_sock.c b/source/lib/util_sock.c index b4fda54ebd7..4a73f92bd82 100644 --- a/source/lib/util_sock.c +++ b/source/lib/util_sock.c @@ -1325,12 +1325,14 @@ int open_socket_in(int type, { struct sockaddr_storage sock; int res; + socklen_t slen = sizeof(struct sockaddr_in); sock = *psock; #if defined(HAVE_IPV6) if (sock.ss_family == AF_INET6) { ((struct sockaddr_in6 *)&sock)->sin6_port = htons(port); + slen = sizeof(struct sockaddr_in6); } #endif if (sock.ss_family == AF_INET) { @@ -1374,7 +1376,7 @@ int open_socket_in(int type, } /* now we've got a socket - we need to bind it */ - if( bind( res, (struct sockaddr *)&sock, sizeof(sock) ) == -1 ) { + if (bind(res, (struct sockaddr *)&sock, slen) == -1 ) { if( DEBUGLVL(dlevel) && (port == SMB_PORT1 || port == SMB_PORT2 || port == NMB_PORT) ) { char addr[INET6_ADDRSTRLEN]; |