summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cli/src/cli-cmd-parser.c16
-rw-r--r--libglusterfs/src/statedump.c12
2 files changed, 13 insertions, 15 deletions
diff --git a/cli/src/cli-cmd-parser.c b/cli/src/cli-cmd-parser.c
index b169b77c68d..090a7246913 100644
--- a/cli/src/cli-cmd-parser.c
+++ b/cli/src/cli-cmd-parser.c
@@ -1976,18 +1976,19 @@ cli_cmd_volume_status_parse (const char **words, int wordcount,
}
gf_boolean_t
-cli_cmd_validate_dumpoption (const char *option)
+cli_cmd_validate_dumpoption (const char *arg, char **option)
{
char *opwords[] = {"all", "nfs", "mem", "iobuf", "callpool", "priv",
- "fd", "inode", NULL};
+ "fd", "inode", NULL};
char *w = NULL;
- w = str_getunamb (option, opwords);
+ w = str_getunamb (arg, opwords);
if (!w) {
gf_log ("cli", GF_LOG_DEBUG, "Unknown statedump option %s",
- option);
+ arg);
return _gf_false;
}
+ *option = w;
return _gf_true;
}
@@ -1999,14 +2000,15 @@ cli_cmd_volume_statedump_options_parse (const char **words, int wordcount,
int i = 0;
dict_t *dict = NULL;
int option_cnt = 0;
+ char *option = NULL;
char option_str[100] = {0,};
for (i = 3; i < wordcount; i++, option_cnt++) {
- if (!cli_cmd_validate_dumpoption (words[i])) {
+ if (!cli_cmd_validate_dumpoption (words[i], &option)) {
ret = -1;
goto out;
}
- strncat (option_str, words[i], sizeof (words [i]));
+ strncat (option_str, option, strlen (option));
strncat (option_str, " ", 1);
}
@@ -2014,7 +2016,7 @@ cli_cmd_volume_statedump_options_parse (const char **words, int wordcount,
if (!dict)
goto out;
- ret = dict_set_str (dict, "options", gf_strdup (option_str));
+ ret = dict_set_dynstr (dict, "options", gf_strdup (option_str));
if (ret)
goto out;
diff --git a/libglusterfs/src/statedump.c b/libglusterfs/src/statedump.c
index 8c6fe92158d..3811ef69234 100644
--- a/libglusterfs/src/statedump.c
+++ b/libglusterfs/src/statedump.c
@@ -529,12 +529,8 @@ gf_proc_dump_parse_set_option (char *key, char *value)
"matched key : %s\n", key);
ret = write (gf_dump_fd, buf, strlen (buf));
- /* warning suppression */
- if (ret >= 0) {
- ret = -1;
- goto out;
- }
-
+ ret = -1;
+ goto out;
}
opt_value = (strncasecmp (value, "yes", 3) ?
@@ -618,11 +614,11 @@ gf_proc_dump_info (int signum)
} else
strncpy (brick_name, "glusterdump", sizeof (brick_name));
- ret = gf_proc_dump_options_init (brick_name);
+ ret = gf_proc_dump_open (ctx->statedump_path, brick_name);
if (ret < 0)
goto out;
- ret = gf_proc_dump_open (ctx->statedump_path, brick_name);
+ ret = gf_proc_dump_options_init (brick_name);
if (ret < 0)
goto out;