From 953f89d82f2c444719ba3150c9890c072a2e7fb3 Mon Sep 17 00:00:00 2001 From: Pranith K Date: Thu, 16 Dec 2010 01:24:33 +0000 Subject: glusterd,cli: print single error message on failure Signed-off-by: Pranith Kumar K Signed-off-by: Anand V. Avati BUG: 1922 (Volume not present wrong message displayed on command line) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1922 --- cli/src/cli-cmd.c | 35 +++++++++++++++++++++++++++++++++-- 1 file changed, 33 insertions(+), 2 deletions(-) (limited to 'cli/src/cli-cmd.c') diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index f09c62106..2b9aea191 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -59,6 +59,38 @@ cli_cmd_needs_connection (struct cli_cmd_word *word) return _gf_true; } +int +cli_cmd_status_reset (void) +{ + int ret = 0; + + ret = cli_cmd_lock (); + { + if (ret == 0) { + cmd_sent = 0; + cmd_done = 0; + } + } + ret = cli_cmd_unlock (); + return ret; + +} + +int +cli_cmd_sent_status_get (int *status) +{ + int ret = 0; + GF_ASSERT (status); + + ret = cli_cmd_lock (); + { + if (ret == 0) + *status = cmd_sent; + } + ret = cli_cmd_unlock (); + return ret; +} + int cli_cmd_process (struct cli_state *state, int argc, char **argv) { @@ -112,11 +144,10 @@ cli_cmd_process (struct cli_state *state, int argc, char **argv) callback: ret = word->cbkfn (state, word, (const char **)argv, argc); - + (void) cli_cmd_status_reset (); return ret; } - int cli_cmd_input_token_count (const char *text) { -- cgit