diff options
Diffstat (limited to 'cli/src')
-rw-r--r-- | cli/src/cli-cmd-parser.c | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c index 3d8ec5d8f..87d29972b 100644 --- a/cli/src/cli-cmd-parser.c +++ b/cli/src/cli-cmd-parser.c @@ -2899,29 +2899,19 @@ cli_snap_create_parse (dict_t *dict, const char **words, int wordcount, goto out; } - /* Only one volume is present. volname - * should be set and not volname%d. */ - if (volcount == 1) { - ret = dict_set_str (dict, "volname", (char *)words[2]); + /* Saving the volume names */ + for (i = 2; i < volcount + 2; i++) { + ret = snprintf (volname_buf, sizeof(volname_buf) - 1, + "volname%d", i - 1); + volname_buf[ret] = '\0'; + + ret = dict_set_str (dict, volname_buf, + (char *)words[i]); if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to save volname"); + gf_log ("", GF_LOG_ERROR, "Unable to save %s", + volname_buf); goto out; } - } else { - /* Saving the volume names */ - for (i = 2; i < volcount + 2; i++) { - ret = snprintf (volname_buf, sizeof(volname_buf) - 1, - "volname%d", i - 1); - volname_buf[ret] = '\0'; - - ret = dict_set_str (dict, volname_buf, - (char *)words[i]); - if (ret) { - gf_log ("", GF_LOG_ERROR, "Unable to save %s", - volname_buf); - goto out; - } - } } /* Saving the volcount */ |