summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-transport/socket
diff options
context:
space:
mode:
authorGaurav <gaurav@gluster.com>2011-03-23 00:50:17 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-23 04:55:29 -0700
commit9bd4f25b6b0ea8103324b685fcc21525a29849a8 (patch)
tree7b0e0b875934521dea0c6fdd3412ac61972a527e /rpc/rpc-transport/socket
parent6f6c817314a2a867be996c2ad6d9a1337617ded4 (diff)
CLI : Validate options farmework.
Signed-off-by: Gaurav <gaurav@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2064 (NFS options are removed upon glusterd restart) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2064
Diffstat (limited to 'rpc/rpc-transport/socket')
-rw-r--r--rpc/rpc-transport/socket/src/socket.c33
1 files changed, 7 insertions, 26 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 395bf738427..62f22e20f1c 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -2457,41 +2457,21 @@ struct rpc_transport_ops tops = {
};
int
-validate_options (rpc_transport_t *this, dict_t *options, char **op_errstr)
-{
- char *optstr = NULL;
- int ret = -1;
- gf_boolean_t tmp_bool = _gf_false;
-
- if (dict_get_str (options, "transport.socket.keepalive",
- &optstr) == 0) {
- if (gf_string2boolean (optstr, &tmp_bool) == -1) {
- gf_log (this->name, GF_LOG_ERROR,
- "'transport.socket.keepalive' takes only "
- "boolean options, not taking any action");
- *op_errstr = "Value should be only boolean!!";
- ret =-1;
- goto out;
- }
- }
-
- ret =0;
-out:
- return ret;
-
-}
-
-int
reconfigure (rpc_transport_t *this, dict_t *options)
{
socket_private_t *priv = NULL;
gf_boolean_t tmp_bool = _gf_false;
char *optstr = NULL;
- int ret = -1;
+ int ret = 0;
GF_VALIDATE_OR_GOTO ("socket", this, out);
GF_VALIDATE_OR_GOTO ("socket", this->private, out);
+ if (!this || !this->private) {
+ ret =-1;
+ goto out;
+ }
+
priv = this->private;
if (dict_get_str (this->options, "transport.socket.keepalive",
@@ -2501,6 +2481,7 @@ reconfigure (rpc_transport_t *this, dict_t *options)
"'transport.socket.keepalive' takes only "
"boolean options, not taking any action");
priv->keepalive = 1;
+ ret = -1;
goto out;
}
gf_log (this->name, GF_LOG_DEBUG, "Reconfigured transport.socket.keepalive");