summaryrefslogtreecommitdiffstats
path: root/cli
diff options
context:
space:
mode:
authorManikandan Selvaganesh <mselvaga@redhat.com>2016-01-28 12:35:40 +0530
committerRaghavendra G <rgowdapp@redhat.com>2016-02-10 22:11:06 -0800
commitbd71d153475761de4b99bf47d90850dc7f05c4a6 (patch)
tree8f8cda5c31449c09bca936d53d176671a2caa3dc /cli
parent3f5783a76196852f671d5d3a570420e712f31e28 (diff)
cli/quota : quota is not enforcing when limit is set to 0
When limit value is set to 0, quota assumes that limit is not set and is not enforcing currently. The patch fixes this issue by restricting the user from setting limit value = 0. Backport of http://review.gluster.org/#/c/13309/ > Change-Id: I316653165cd9766600f95b5f23e5b8abcc2b41e7 > BUG: 1302554 > Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Change-Id: I83623cba54873f27bd65d5d6d85b1f8e9d895f55 BUG: 1306136 Signed-off-by: Manikandan Selvaganesh <mselvaga@redhat.com> Reviewed-on: http://review.gluster.org/13417 Smoke: Gluster Build System <jenkins@build.gluster.com> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org> CentOS-regression: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Raghavendra G <rgowdapp@redhat.com>
Diffstat (limited to 'cli')
-rw-r--r--cli/src/cli-cmd-parser.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 2c3d01b..08cdce4 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1090,12 +1090,14 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options)
if (type == GF_QUOTA_OPTION_TYPE_LIMIT_USAGE) {
ret = gf_string2bytesize_int64 (words[5], &value);
- if (ret != 0 || value < 0) {
- if (errno == ERANGE || value < 0)
- cli_err ("Value out of range "
- "(0 - %"PRId64 "): %s",
- INT64_MAX, words[5]);
- else
+ if (ret != 0 || value <= 0) {
+ if (errno == ERANGE || value <= 0) {
+ ret = -1;
+ cli_err ("Please enter an integer "
+ "value in the range of "
+ "(1 - %"PRId64 ")",
+ INT64_MAX);
+ } else
cli_err ("Please enter a correct "
"value");
goto out;
@@ -1106,7 +1108,7 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options)
if (errno == ERANGE || errno == EINVAL || limit <= 0
|| strcmp (end_ptr, "") != 0) {
ret = -1;
- cli_err ("Please enter an interger value in "
+ cli_err ("Please enter an integer value in "
"the range 1 - %"PRId64, INT64_MAX);
goto out;
}