From cc8e13e38931cabcf2d6361554717941bb82c7ab Mon Sep 17 00:00:00 2001 From: Sachidananda Date: Fri, 3 Sep 2010 06:25:54 +0000 Subject: cli: Fix clang errors. Signed-off-by: Sachidananda Urs Signed-off-by: Vijay Bellur BUG: 1145 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1145 --- cli/src/cli-cmd-parser.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'cli/src/cli-cmd-parser.c') diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index f43349416..fb3b162d1 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -345,7 +345,11 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount, goto out; } + errno = 0; count = strtol (words[4], NULL, 0); + if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) + goto out; + brick_index = 5; } else if ((strcasecmp (words[3], "stripe")) == 0) { type = GF_CLUSTER_TYPE_STRIPE; @@ -354,7 +358,11 @@ cli_cmd_volume_add_brick_parse (const char **words, int wordcount, goto out; } + errno = 0; count = strtol (words[4], NULL, 0); + if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) + goto out; + brick_index = 5; } else { brick_index = 3; @@ -478,8 +486,11 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, ret = -1; goto out; } - + errno = 0; count = strtol (words[4], NULL, 0); + if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) + goto out; + brick_index = 5; } else if ((strcasecmp (words[3], "stripe")) == 0) { type = GF_CLUSTER_TYPE_STRIPE; @@ -488,7 +499,11 @@ cli_cmd_volume_remove_brick_parse (const char **words, int wordcount, goto out; } + errno = 0; count = strtol (words[4], NULL, 0); + if (errno == ERANGE && (count == LONG_MAX || count == LONG_MIN)) + goto out; + brick_index = 5; } else { brick_index = 3; -- cgit