tsocket/bsd: fix do_bind logic for AF_INET
authorStefan Metzmacher <metze@samba.org>
Wed, 17 Feb 2010 07:42:22 +0000 (08:42 +0100)
committerStefan Metzmacher <metze@samba.org>
Wed, 17 Feb 2010 13:13:57 +0000 (14:13 +0100)
We want the explicit bind() when we don't use the any address.

metze

lib/tsocket/tsocket_bsd.c

index 7c0255742cffa171d68bd590fb72d077e640fade..5cd7702ff6b1aded6a814e43ae3f630b24c32451 100644 (file)
@@ -1170,7 +1170,7 @@ static int tdgram_bsd_dgram_socket(const struct tsocket_address *local,
                        do_reuseaddr = true;
                        do_bind = true;
                }
-               if (lbsda->u.in.sin_addr.s_addr == INADDR_ANY) {
+               if (lbsda->u.in.sin_addr.s_addr != INADDR_ANY) {
                        do_bind = true;
                }
                break;
@@ -1979,7 +1979,7 @@ static struct tevent_req * tstream_bsd_connect_send(TALLOC_CTX *mem_ctx,
                        do_reuseaddr = true;
                        do_bind = true;
                }
-               if (lbsda->u.in.sin_addr.s_addr == INADDR_ANY) {
+               if (lbsda->u.in.sin_addr.s_addr != INADDR_ANY) {
                        do_bind = true;
                }
                break;