summaryrefslogtreecommitdiffstats
path: root/cli/src
diff options
context:
space:
mode:
authorggarg <ggarg@redhat.com>2014-03-28 12:23:17 +0530
committerVijay Bellur <vbellur@redhat.com>2014-04-28 08:42:10 -0700
commita3c12fdabea5ee77ab95bc65962e56083b7d0fa6 (patch)
tree16e5dd847112bd2f5586948a9e3a14fc29de55ca /cli/src
parentf2bac9f9d5b9956969ddd25a54bc636b82f6923e (diff)
cli: Error out when character "." is available in volume name
previously it was failed without showing any information why it is failed. Now with this fix, when "." or any non alphanumeric character present in volume name, it will give error messages Change-Id: I17e8e69c08345c4d760f3ba333fe841e754bc9c8 BUG: 921215 Signed-off-by: ggarg <ggarg@redhat.com> Reviewed-on: http://review.gluster.org/7364 Reviewed-by: Humble Devassy Chirammal <humble.devassy@gmail.com> Reviewed-by: Atin Mukherjee <amukherj@redhat.com> Reviewed-by: Vijay Bellur <vbellur@redhat.com> Tested-by: Gluster Build System <jenkins@build.gluster.com>
Diffstat (limited to 'cli/src')
-rw-r--r--cli/src/cli-cmd-parser.c16
1 files changed, 14 insertions, 2 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index 36f710f0385..b53b1ee648b 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -240,8 +240,14 @@ cli_cmd_volume_create_parse (const char **words, int wordcount, dict_t **options
goto out;
for (i = 0; i < strlen (volname); i++)
- if (!isalnum (volname[i]) && (volname[i] != '_') && (volname[i] != '-'))
+ if (!isalnum (volname[i]) && (volname[i] != '_') &&
+ (volname[i] != '-')) {
+ cli_err ("Volume name should not contain \"%c\""
+ " character.\nVolume names can only"
+ "contain alphanumeric, '-' and '_' "
+ "characters.",volname[i]);
goto out;
+ }
}
if (wordcount < 4) {
@@ -559,8 +565,14 @@ cli_cmd_quota_parse (const char **words, int wordcount, dict_t **options)
goto out;
for (i = 0; i < strlen (volname); i++)
- if (!isalnum (volname[i]) && (volname[i] != '_') && (volname[i] != '-'))
+ if (!isalnum (volname[i]) && (volname[i] != '_') &&
+ (volname[i] != '-')) {
+ cli_err ("Volume name should not contain \"%c\""
+ " character.\nVolume names can only"
+ "contain alphanumeric, '-' and '_' "
+ "characters.",volname[i]);
goto out;
+ }
}
ret = dict_set_str (dict, "volname", volname);