From f3078b1c7faeac3b09db8672241d624d7365dd76 Mon Sep 17 00:00:00 2001 From: Harald Klatte Date: Mon, 30 Aug 2010 10:40:43 +0200 Subject: [PATCH] AIX bind wants the correct addrsize (This used to be ctdb commit b5169e037fe113a5b62f510646b8fefc055c053b) --- ctdb/common/system_common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ctdb/common/system_common.c b/ctdb/common/system_common.c index 9aa4620bd82..f28045f95e5 100644 --- a/ctdb/common/system_common.c +++ b/ctdb/common/system_common.c @@ -50,13 +50,16 @@ bool ctdb_sys_have_ip(ctdb_sock_addr *_addr) int ret; ctdb_sock_addr __addr = *_addr; ctdb_sock_addr *addr = &__addr; + socklen_t addrlen; switch (addr->sa.sa_family) { case AF_INET: addr->ip.sin_port = 0; + addrlen = sizeof(struct sockaddr_in); break; case AF_INET6: addr->ip6.sin6_port = 0; + addrlen = sizeof(struct sockaddr_in6); break; } @@ -65,7 +68,7 @@ bool ctdb_sys_have_ip(ctdb_sock_addr *_addr) return false; } - ret = bind(s, (struct sockaddr *)addr, sizeof(ctdb_sock_addr)); + ret = bind(s, (struct sockaddr *)addr, addrlen); close(s); return ret == 0;