summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/rpcsvc.c
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 /rpc/rpc-lib/src/rpcsvc.c
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
Diffstat (limited to 'rpc/rpc-lib/src/rpcsvc.c')
-rw-r--r--rpc/rpc-lib/src/rpcsvc.c51
1 files changed, 29 insertions, 22 deletions
diff --git a/rpc/rpc-lib/src/rpcsvc.c b/rpc/rpc-lib/src/rpcsvc.c
index bb4e37ef8b0..9bb7e0e4c9e 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