summaryrefslogtreecommitdiffstats
path: root/cli/src/cli-cmd-parser.c
diff options
context:
space:
mode:
Diffstat (limited to 'cli/src/cli-cmd-parser.c')
-rw-r--r--cli/src/cli-cmd-parser.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index c5d6fa009..4357e657e 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -2843,6 +2843,14 @@ cli_snap_create_parse (dict_t *dict, const char **words, int wordcount,
goto out;
}
+ if (strlen(words[cmdi]) >= GLUSTERD_MAX_SNAP_NAME) {
+ cli_out ("snapshot create: failed: snapname cannot exceed "
+ "256 characters.");
+ gf_log ("cli", GF_LOG_ERROR, "Snapname too long");
+
+ goto out;
+ }
+
/* Snap name cannot be keyword "description" or "force" */
if (strcmp (words[cmdi], "description") == 0 ||
strcmp (words[cmdi], "force") == 0) {
@@ -3252,6 +3260,7 @@ out :
*
* return value : -1 on failure
* 0 on success
+ * 1 if user cancel the operation
*/
int
cli_snap_delete_parse (dict_t *dict, const char **words, int wordcount,
@@ -3281,7 +3290,7 @@ cli_snap_delete_parse (dict_t *dict, const char **words, int wordcount,
answer = cli_cmd_get_confirmation (state, question);
if (GF_ANSWER_NO == answer) {
- ret = -1;
+ ret = 1;
gf_log ("cli", GF_LOG_DEBUG, "User cancelled "
"snapshot delete operation");
goto out;