From cfe11cd627f8322ad2701dad6c021d3570bbbf1d Mon Sep 17 00:00:00 2001 From: Krishnan Parthasarathi Date: Fri, 15 Apr 2011 01:00:56 +0000 Subject: top: Modified integer bounds check for count/bs Signed-off-by: Krishnan Parthasarathi Signed-off-by: Anand Avati BUG: 2721 (Incorrect validation message in gluster top CLI) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2721 --- cli/src/cli-cmd-parser.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 7ddeb511c25..aead5f42727 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; } -- cgit