summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2010-07-27 11:12:51 +0000
committerAnand V. Avati <avati@dev.gluster.com>2010-07-28 03:34:44 -0700
commit0aae2c46579421b871919e93619273d9a9bc79fb (patch)
treec9b7405a80f509d5a5da2cf4882144cabf5b93c7
parentb2b6281e3487d3d797ab7974df69790a28c443c9 (diff)
fix all the clang errors in 'rpc/*'
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Anand V. Avati <avati@dev.gluster.com> BUG: 1133 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1133
-rw-r--r--rpc/rpc-lib/src/rpc-clnt.c5
-rw-r--r--rpc/rpc-lib/src/rpc-transport.c2
-rw-r--r--rpc/rpc-lib/src/rpcsvc-auth.c22
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c51
-rw-r--r--rpc/rpc-transport/socket/src/name.c18
-rw-r--r--rpc/rpc-transport/socket/src/socket.c11
6 files changed, 62 insertions, 47 deletions
diff --git a/rpc/rpc-lib/src/rpc-clnt.c b/rpc/rpc-lib/src/rpc-clnt.c
index f2c2736e0..9b0bfe33d 100644
--- a/rpc/rpc-lib/src/rpc-clnt.c
+++ b/rpc/rpc-lib/src/rpc-clnt.c
@@ -129,7 +129,6 @@ call_bail (void *data)
struct tm frame_sent_tm;
char frame_sent[32] = {0,};
struct timeval timeout = {0,};
- gf_timer_cbk_t timer_cbk = NULL;
struct rpc_req req;
struct iovec iov = {0,};
@@ -147,8 +146,6 @@ call_bail (void *data)
/* Chaining to get call-always functionality from
call-once timer */
if (conn->timer) {
- timer_cbk = conn->timer->callbk;
-
timeout.tv_sec = 10;
timeout.tv_usec = 0;
@@ -673,8 +670,6 @@ rpc_clnt_handle_reply (struct rpc_clnt *clnt, rpc_transport_pollin_t *pollin)
if (ret == 0) {
rpc_clnt_reply_deinit (&req);
}
-
- ret = 0;
out:
if (saved_frame) {
diff --git a/rpc/rpc-lib/src/rpc-transport.c b/rpc/rpc-lib/src/rpc-transport.c
index 82ea9a74b..b77ea2aa5 100644
--- a/rpc/rpc-lib/src/rpc-transport.c
+++ b/rpc/rpc-lib/src/rpc-transport.c
@@ -79,7 +79,7 @@ valid_ipv4_address (char *address, int length)
char *tmp = NULL, *ptr = NULL, *prev = NULL, *endptr = NULL;
char ret = 1;
- prev = tmp = gf_strdup (address);
+ tmp = gf_strdup (address);
prev = strtok_r (tmp, ".", &ptr);
while (prev != NULL)
diff --git a/rpc/rpc-lib/src/rpcsvc-auth.c b/rpc/rpc-lib/src/rpcsvc-auth.c
index 75305e68e..381cf2823 100644
--- a/rpc/rpc-lib/src/rpcsvc-auth.c
+++ b/rpc/rpc-lib/src/rpcsvc-auth.c
@@ -85,7 +85,7 @@ rpcsvc_auth_add_initers (rpcsvc_t *svc)
ret = 0;
err:
- return 0;
+ return ret;
}
@@ -142,14 +142,26 @@ rpcsvc_auth_init_auths (rpcsvc_t *svc, dict_t *options)
* it by default. This is a globally default rule, the user is still
* allowed to disable the two for particular subvolumes.
*/
- if (!dict_get (options, "rpc-auth.auth-null"))
+ if (!dict_get (options, "rpc-auth.auth-null")) {
ret = dict_set_str (options, "rpc-auth.auth-null", "on");
+ if (ret)
+ gf_log ("rpc-auth", GF_LOG_DEBUG,
+ "dict_set failed for 'auth-nill'");
+ }
- if (!dict_get (options, "rpc-auth.auth-unix"))
+ if (!dict_get (options, "rpc-auth.auth-unix")) {
ret = dict_set_str (options, "rpc-auth.auth-unix", "on");
+ if (ret)
+ gf_log ("rpc-auth", GF_LOG_DEBUG,
+ "dict_set failed for 'auth-unix'");
+ }
- if (!dict_get (options, "rpc-auth.auth-glusterfs"))
+ if (!dict_get (options, "rpc-auth.auth-glusterfs")) {
ret = dict_set_str (options, "rpc-auth.auth-glusterfs", "on");
+ if (ret)
+ gf_log ("rpc-auth", GF_LOG_DEBUG,
+ "dict_set failed for 'auth-unix'");
+ }
list_for_each_entry_safe (auth, tmp, &svc->authschemes, authlist) {
ret = rpcsvc_auth_init_auth (svc, options, auth);
@@ -191,7 +203,6 @@ out:
rpcsvc_auth_t *
__rpcsvc_auth_get_handler (rpcsvc_request_t *req)
{
- int ret = -1;
struct rpcsvc_auth_list *auth = NULL;
struct rpcsvc_auth_list *tmp = NULL;
rpcsvc_t *svc = NULL;
@@ -207,7 +218,6 @@ __rpcsvc_auth_get_handler (rpcsvc_request_t *req)
if (list_empty (&svc->authschemes)) {
gf_log (GF_RPCSVC, GF_LOG_WARNING, "No authentication!");
- ret = 0;
goto err;
}
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index bb4e37ef8..9bb7e0e4c 100644
--- a/rpc/rpc-lib/src/rpcsvc.c
+++ b/rpc/rpc-lib/src/rpcsvc.c
@@ -371,8 +371,13 @@ rpcsvc_conn_check_volume_specific (dict_t *options, char *volname,
if ((dict_get (options, "rpc-auth.addr.namelookup"))) {
ret = dict_get_str (options, "rpc-auth.addr.namelookup"
, &namestr);
- if (ret == 0)
+ if (ret == 0) {
ret = gf_string2boolean (namestr, &namelookup);
+ if (ret)
+ gf_log ("rpcsvc", GF_LOG_DEBUG,
+ "wrong option %s given for "
+ "'namelookup'", namestr);
+ }
}
/* We need two separate checks because the rules with addresses in them
@@ -408,8 +413,13 @@ rpcsvc_conn_check_volume_general (dict_t *options, rpcsvc_conn_t *conn)
if ((dict_get (options, "rpc-auth.addr.namelookup"))) {
ret = dict_get_str (options, "rpc-auth.addr.namelookup"
, &namestr);
- if (ret == 0)
+ if (!ret) {
ret = gf_string2boolean (namestr, &namelookup);
+ if (ret)
+ gf_log ("rpcsvc", GF_LOG_DEBUG,
+ "wrong option %s given for "
+ "'namelookup'", namestr);
+ }
}
/* We need two separate checks because the rules with addresses in them
@@ -466,9 +476,15 @@ rpcsvc_volume_allowed (dict_t *options, char *volname)
GF_FREE (srchstr);
srchstr = globalrule;
ret = dict_get_str (options, srchstr, &addrstr);
- } else
+ if (ret)
+ gf_log ("rpcsvc", GF_LOG_DEBUG,
+ "failed to get the string %s", srchstr);
+ } else {
ret = dict_get_str (options, srchstr, &addrstr);
-
+ if (ret)
+ gf_log ("rpcsvc", GF_LOG_DEBUG,
+ "failed to get the string %s", srchstr);
+ }
out:
return addrstr;
}
@@ -657,7 +673,6 @@ rpcsvc_conn_init (rpcsvc_t *svc, rpc_transport_t *trans)
conn = rpcsvc_conn_alloc (svc, trans);
if (!conn) {
- ret = -1;
gf_log (GF_RPCSVC, GF_LOG_DEBUG, "cannot init a connection");
goto out;
}
@@ -1143,6 +1158,9 @@ rpcsvc_request_create (rpcsvc_conn_t *conn, rpc_transport_pollin_t *msg)
err:
if (ret == -1) {
ret = rpcsvc_error_reply (req);
+ if (ret)
+ gf_log ("rpcsvc", GF_LOG_DEBUG,
+ "failed to queue error reply");
req = NULL;
}
@@ -1195,6 +1213,9 @@ err_reply:
if ((ret == RPCSVC_ACTOR_ERROR) || (req->rpc_err != SUCCESS))
ret = rpcsvc_error_reply (req);
+ if (ret)
+ gf_log ("rpcsvc", GF_LOG_DEBUG, "failed to queue error reply");
+
/* No need to propagate error beyond this function since the reply
* has now been queued. */
ret = 0;
@@ -1208,7 +1229,6 @@ rpcsvc_notify (rpc_transport_t *trans, void *mydata,
rpc_transport_event_t event, void *data, ...)
{
rpcsvc_conn_t *conn = NULL;
- rpcsvc_t *svc = NULL;
int ret = -1;
rpc_transport_pollin_t *msg = NULL;
rpc_transport_t *new_trans = NULL;
@@ -1218,8 +1238,6 @@ rpcsvc_notify (rpc_transport_t *trans, void *mydata,
goto out;
}
- svc = conn->svc;
-
switch (event) {
case RPC_TRANSPORT_ACCEPT:
new_trans = data;
@@ -1765,7 +1783,6 @@ rpcsvc_listener_t *
rpcsvc_listener_alloc (rpcsvc_t *svc, rpcsvc_conn_t *conn)
{
rpcsvc_listener_t *listener = NULL;
- int ret = -1;
listener = GF_CALLOC (1, sizeof (*listener),
gf_common_mt_rpcsvc_listener_t);
@@ -1774,17 +1791,6 @@ rpcsvc_listener_alloc (rpcsvc_t *svc, rpcsvc_conn_t *conn)
goto out;
}
- /* TODO: unresolved symbol */
- ret = rpc_transport_get_myaddr (conn->trans, NULL, 0,
- &listener->sa,
- sizeof (listener->sa));
- ret = 0;
- if (ret == -1) {
- GF_FREE (listener);
- listener = NULL;
- goto out;
- }
-
listener->conn = conn;
INIT_LIST_HEAD (&listener->list);
@@ -2005,7 +2011,8 @@ fail:
ret = xdr_serialize_dump_rsp (iov, &rsp);
if (ret < 0) {
- req->rpc_err = GARBAGE_ARGS;
+ if (req)
+ req->rpc_err = GARBAGE_ARGS;
op_errno = EINVAL;
goto fail;
}
@@ -2015,7 +2022,7 @@ fail:
free_prog_details (&rsp);
- return 0;
+ return ret;
}
int
diff --git a/rpc/rpc-transport/socket/src/name.c b/rpc/rpc-transport/socket/src/name.c
index 763fa3dd0..e5b9199aa 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 b40a93ee8..6406d4589 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;