summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libglusterfs/src/common-utils.c10
-rw-r--r--rpc/rpc-transport/rdma/src/name.c8
-rw-r--r--rpc/rpc-transport/socket/src/name.c10
3 files changed, 13 insertions, 15 deletions
diff --git a/libglusterfs/src/common-utils.c b/libglusterfs/src/common-utils.c
index bfddfc3124c..a1a4c7d43ae 100644
--- a/libglusterfs/src/common-utils.c
+++ b/libglusterfs/src/common-utils.c
@@ -2980,6 +2980,12 @@ int
gf_process_reserved_ports (gf_boolean_t *ports, uint32_t ceiling)
{
int ret = -1;
+ int i = 0;
+
+ for (i = 0; i < GF_PORT_MAX; i++) {
+ *(ports + i) = _gf_false;
+ }
+
#if defined GF_LINUX_HOST_OS
char *ports_info = NULL;
char *tmp = NULL;
@@ -3005,7 +3011,11 @@ gf_process_reserved_ports (gf_boolean_t *ports, uint32_t ceiling)
out:
GF_FREE (ports_info);
+
+#else /* FIXME: Non Linux Host */
+ ret = 0;
#endif /* GF_LINUX_HOST_OS */
+
return ret;
}
diff --git a/rpc/rpc-transport/rdma/src/name.c b/rpc/rpc-transport/rdma/src/name.c
index 93b249855e1..d4502e766bf 100644
--- a/rpc/rpc-transport/rdma/src/name.c
+++ b/rpc/rpc-transport/rdma/src/name.c
@@ -56,15 +56,9 @@ af_inet_bind_to_port_lt_ceiling (struct rdma_cm_id *cm_id,
{
int32_t ret = -1;
uint16_t port = ceiling - 1;
- /* by default assume none of the ports are blocked and all are available */
- gf_boolean_t ports[GF_PORT_MAX] = {_gf_false,};
- int i = 0;
+ gf_boolean_t ports[GF_PORT_MAX];
ret = gf_process_reserved_ports (ports, ceiling);
- if (ret != 0) {
- for (i = 0; i < GF_PORT_MAX; i++)
- ports[i] = _gf_false;
- }
while (port) {
/* ignore the reserved ports */
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index 725a8c18120..12887a72ff1 100644
--- a/rpc/rpc-transport/socket/src/name.c
+++ b/rpc/rpc-transport/socket/src/name.c
@@ -44,19 +44,13 @@ af_inet_bind_to_port_lt_ceiling (int fd, struct sockaddr *sockaddr,
{
int32_t ret = -1;
uint16_t port = ceiling - 1;
- // by default assume none of the ports are blocked and all are available
- gf_boolean_t ports[GF_PORT_MAX] = {_gf_false,};
- int i = 0;
+ gf_boolean_t ports[GF_PORT_MAX];
ret = gf_process_reserved_ports (ports, ceiling);
- if (ret != 0) {
- for (i = 0; i < GF_PORT_MAX; i++)
- ports[i] = _gf_false;
- }
while (port)
{
- // ignore the reserved ports
+ /* ignore the reserved ports */
if (ports[port] == _gf_true) {
port--;
continue;