perf callchains: Switch from strtok() to strtok_r() when parsing options

Trying to keep everything reentrant.

Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-rdce0p2k9e1b4qnrb8ki9mtf@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 9df9078e
...@@ -116,7 +116,7 @@ static int ...@@ -116,7 +116,7 @@ static int
__parse_callchain_report_opt(const char *arg, bool allow_record_opt) __parse_callchain_report_opt(const char *arg, bool allow_record_opt)
{ {
char *tok; char *tok;
char *endptr; char *endptr, *saveptr = NULL;
bool minpcnt_set = false; bool minpcnt_set = false;
bool record_opt_set = false; bool record_opt_set = false;
bool try_stack_size = false; bool try_stack_size = false;
...@@ -127,7 +127,7 @@ __parse_callchain_report_opt(const char *arg, bool allow_record_opt) ...@@ -127,7 +127,7 @@ __parse_callchain_report_opt(const char *arg, bool allow_record_opt)
if (!arg) if (!arg)
return 0; return 0;
while ((tok = strtok((char *)arg, ",")) != NULL) { while ((tok = strtok_r((char *)arg, ",", &saveptr)) != NULL) {
if (!strncmp(tok, "none", strlen(tok))) { if (!strncmp(tok, "none", strlen(tok))) {
callchain_param.mode = CHAIN_NONE; callchain_param.mode = CHAIN_NONE;
callchain_param.enabled = false; callchain_param.enabled = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment