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.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
This commit is contained in:
parent
9df9078ef2
commit
dadafc315d
|
@ -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)
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue