diff options
Diffstat (limited to 'rpc')
-rw-r--r-- | rpc/rpc-transport/rdma/src/name.c | 8 | ||||
-rw-r--r-- | rpc/rpc-transport/socket/src/name.c | 10 |
2 files changed, 3 insertions, 15 deletions
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; |