From 625f779dba824d40626473cd85aaacdefbfae1ce Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Thu, 21 Apr 2011 17:38:10 +0000 Subject: cli: fix up parsing of geo-replication status Signed-off-by: Csaba Henk Signed-off-by: Anand Avati BUG: 2785 (gsyncd logs on slave side go to /dev/null) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2785 --- cli/src/cli-cmd-parser.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 2954609b7..735dcb02b 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -1168,15 +1168,18 @@ cli_cmd_gsync_set_parse (const char **words, int wordcount, dict_t **options) cmdi = slavei + 1; if (slavei == 3) masteri = 2; - } else if (i == 2) { + } else if (i <= 3) { /* no $s, can only be status cmd - * (with either a single $m before it or nothing; - * i remaining 2 is a good check for this condition) + * (with either a single $m before it or nothing) + * -- these conditions imply that i <= 3 after + * the iteration and that i is the successor of + * the (0 or 1 length) sequence of $m-s. */ - cmdi = wordcount - 1; - if (i < cmdi) - masteri = i; - } + cmdi = i; + if (i == 3) + masteri = 2; + } else + goto out; /* now check if input really complies syntax * (in a somewhat redundant way, in favor -- cgit