summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorKrishnan Parthasarathi <kp@gluster.com>2011-04-15 01:00:56 +0000
committerAnand Avati <avati@gluster.com>2011-04-15 04:28:46 -0700
commitcfe11cd627f8322ad2701dad6c021d3570bbbf1d (patch)
tree353b14f7eaa5e80f793e3868b8909ee253ab79dc /cli/src
parent7a56f1b9a18e4863917e4b6aaeacba2e28073ab6 (diff)
top: Modified integer bounds check for count/bs
Signed-off-by: Krishnan Parthasarathi <kp@gluster.com> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2721 (Incorrect validation message in gluster top CLI) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2721
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 7ddeb511c..aead5f427 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1433,7 +1433,10 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
if (!ret)
blk_size = atoi (value);
if (ret || (blk_size <= 0)) {
- cli_out ("block size should be an integer "
+ if (blk_size < 0)
+ cli_out ("block size is an invalid number");
+ else
+ cli_out ("block size should be an integer "
"greater than zero");
ret = -1;
goto out;
@@ -1444,8 +1447,12 @@ cli_cmd_volume_top_parse (const char **words, int wordcount,
if (!ret)
count = atoi(value);
if (ret || (count <= 0)) {
- cli_out ("count should be an integer greater "
- "zero");
+ if (count < 0)
+ cli_out ("count is an invalid number");
+ else
+ cli_out ("count should be an integer "
+ "greater than zero");
+
ret = -1;
goto out;
}