tsocket/bsd: fix bug #7140 use calculated sa_socklen for bind() in tstream_bsd_connec...
authorStefan Metzmacher <metze@samba.org>
Wed, 17 Feb 2010 07:45:58 +0000 (08:45 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 17 Feb 2010 13:45:34 +0000 (14:45 +0100)
This is needed because, we can't use sizeof(sockaddr_storage) for AF_UNIX
sockets. Also some platforms require exact values for AF_INET and AF_INET6.

metze

lib/tsocket/tsocket_bsd.c

index 5cd7702ff6b1aded6a814e43ae3f630b24c32451..8d1fe3208342c9a6f3bd37aab183aa71e033b0fc 100644 (file)
@@ -2025,7 +2025,7 @@ static struct tevent_req * tstream_bsd_connect_send(TALLOC_CTX *mem_ctx,
        }
 
        if (do_bind) {
-               ret = bind(state->fd, &lbsda->u.sa, sizeof(lbsda->u.ss));
+               ret = bind(state->fd, &lbsda->u.sa, sa_socklen);
                if (ret == -1) {
                        tevent_req_error(req, errno);
                        goto post;