From 0aae2c46579421b871919e93619273d9a9bc79fb Mon Sep 17 00:00:00 2001 From: Amar Tumballi Date: Tue, 27 Jul 2010 11:12:51 +0000 Subject: fix all the clang errors in 'rpc/*' Signed-off-by: Amar Tumballi Signed-off-by: Anand V. Avati BUG: 1133 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1133 --- rpc/rpc-transport/socket/src/name.c | 18 ++++++++++-------- rpc/rpc-transport/socket/src/socket.c | 11 ++++++----- 2 files changed, 16 insertions(+), 13 deletions(-) (limited to 'rpc/rpc-transport/socket') diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c index 763fa3dd09b..e5b9199aa35 100644 --- a/rpc/rpc-transport/socket/src/name.c +++ b/rpc/rpc-transport/socket/src/name.c @@ -605,21 +605,23 @@ int32_t fill_inet6_inet_identifiers (rpc_transport_t *this, struct sockaddr_storage *addr, int32_t addr_len, char *identifier) { - int32_t ret = 0, tmpaddr_len = 0; - char service[NI_MAXSERV], host[NI_MAXHOST]; struct sockaddr_storage tmpaddr; + char service[NI_MAXSERV] = {0,}; + char host[NI_MAXHOST] = {0,}; + int32_t ret = 0; + int32_t tmpaddr_len = 0; + int32_t one_to_four = 0; + int32_t four_to_eight = 0; + int32_t twelve_to_sixteen = 0; + int16_t eight_to_ten = 0; + int16_t ten_to_twelve = 0; + memset (&tmpaddr, 0, sizeof (tmpaddr)); tmpaddr = *addr; tmpaddr_len = addr_len; if (((struct sockaddr *) &tmpaddr)->sa_family == AF_INET6) { - int32_t one_to_four, four_to_eight, twelve_to_sixteen; - int16_t eight_to_ten, ten_to_twelve; - - one_to_four = four_to_eight = twelve_to_sixteen = 0; - eight_to_ten = ten_to_twelve = 0; - one_to_four = ((struct sockaddr_in6 *) &tmpaddr)->sin6_addr.s6_addr32[0]; four_to_eight = ((struct sockaddr_in6 *) &tmpaddr)->sin6_addr.s6_addr32[1]; #ifdef GF_SOLARIS_HOST_OS diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index b40a93ee821..6406d4589e9 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -392,12 +392,9 @@ __socket_reset (rpc_transport_t *this) struct ioq * __socket_ioq_new (rpc_transport_t *this, rpc_transport_msg_t *msg) { - socket_private_t *priv = NULL; struct ioq *entry = NULL; int count = 0; - priv = this->private; - /* TODO: use mem-pool */ entry = GF_CALLOC (1, sizeof (*entry), gf_common_mt_ioq); if (!entry) @@ -1553,7 +1550,11 @@ socket_server_event_handler (int fd, int idx, void *data, ret = -1; } pthread_mutex_unlock (&new_priv->lock); - ret = rpc_transport_notify (this, RPC_TRANSPORT_ACCEPT, new_trans); + if (ret == -1) + goto unlock; + + ret = rpc_transport_notify (this, RPC_TRANSPORT_ACCEPT, + new_trans); } } unlock: @@ -2112,7 +2113,7 @@ int32_t socket_getmyaddr (rpc_transport_t *this, char *myaddr, int addrlen, struct sockaddr *sa, socklen_t salen) { - int32_t ret = -1; + int32_t ret = 0; if ((this == NULL) || (sa == NULL)) { goto out; -- cgit