diff options
| author | luozhengzheng <luo.zhengzheng@zte.com.cn> | 2016-09-23 16:10:50 +0000 |
|---|---|---|
| committer | Brian Behlendorf <behlendorf1@llnl.gov> | 2016-09-23 16:10:50 +0000 |
| commit | d0662a1beb03033480dc0ac36e905b607e1e8eb8 (patch) | |
| tree | e87f18c77360828ecf699b1fa82ecacfe723dc24 /cmd | |
| parent | d5b897a6a1da2f031a708fd267b4de2cc9b7a6e2 (diff) | |
Diffstat (limited to 'cmd')
| -rw-r--r-- | cmd/zpios/zpios_util.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/cmd/zpios/zpios_util.c b/cmd/zpios/zpios_util.c index 2d248ed9ae9c..b31ba51c8e95 100644 --- a/cmd/zpios/zpios_util.c +++ b/cmd/zpios/zpios_util.c @@ -170,8 +170,11 @@ split_string(const char *optarg, char *pattern, range_repeat_t *range) * value of the * first argument, starts searching from the * saved pointer and behaves as described above. */ - token[i] = strtok(cp, comma); - cp = NULL; + if (i == 0) { + token[i] = strtok(cp, comma); + } else { + token[i] = strtok(NULL, comma); + } } while ((token[i++] != NULL) && (i < 32)); range->val_count = i - 1; @@ -260,12 +263,13 @@ set_noise(uint64_t *noise, char *optarg, char *arg) int set_load_params(cmd_args_t *args, char *optarg) { - char *param, *search, comma[] = ","; + char *param, *search, *searchdup, comma[] = ","; int rc = 0; search = strdup(optarg); if (search == NULL) return (ENOMEM); + searchdup = search; while ((param = strtok(search, comma)) != NULL) { search = NULL; @@ -283,7 +287,7 @@ set_load_params(cmd_args_t *args, char *optarg) } } - free(search); + free(searchdup); return (rc); } |
