From af4d9131c8d09907853ee2f6e30b2a9bd80f3c84 Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Tue, 23 Apr 2019 12:41:32 +0530 Subject: cli: Validate invalid slave url This patch validates the invalid slave url in cli itself and throws appropriate error. fixes: bz#1098991 Change-Id: I278e2a04a4d619d2c2d1db0dd56ab5bdf7e7f469 Signed-off-by: Kotresh HR --- cli/src/cli-cmd-volume.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'cli/src/cli-cmd-volume.c') diff --git a/cli/src/cli-cmd-volume.c b/cli/src/cli-cmd-volume.c index e711608ed80..ab2f18bd679 100644 --- a/cli/src/cli-cmd-volume.c +++ b/cli/src/cli-cmd-volume.c @@ -2138,6 +2138,7 @@ cli_cmd_volume_gsync_set_cbk(struct cli_state *state, struct cli_cmd_word *word, rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; cli_local_t *local = NULL; + char *errstr = NULL; #if (USE_EVENTS) int ret1 = -1; int cmd_type = -1; @@ -2155,9 +2156,14 @@ cli_cmd_volume_gsync_set_cbk(struct cli_state *state, struct cli_cmd_word *word, goto out; } - ret = cli_cmd_gsync_set_parse(words, wordcount, &options); + ret = cli_cmd_gsync_set_parse(words, wordcount, &options, &errstr); if (ret) { - cli_usage_out(word->pattern); + if (errstr) { + cli_err("%s", errstr); + GF_FREE(errstr); + } else { + cli_usage_out(word->pattern); + } parse_err = 1; goto out; } -- cgit