summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSachidananda <sac@gluster.com>2010-09-03 06:25:54 +0000
committerVijay Bellur <vijay@dev.gluster.com>2010-09-03 08:08:09 -0700
commitcc8e13e38931cabcf2d6361554717941bb82c7ab (patch)
tree016959b8274711d543d3746d02cfc3629f3cd91b
parentdd7e5feef61f3e7c6360a410d69b063dee7b3df8 (diff)
cli: Fix clang errors.
Signed-off-by: Sachidananda Urs <sac@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 1145 () URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=1145
-rw-r--r--cli/src/cli-cmd-parser.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index f43349416be..fb3b162d1e7 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;