diff options
author | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-05 10:43:41 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2017-04-11 07:45:09 -0400 |
commit | 49346e858f34eda103d7c0e85c06edbaebfc83a9 (patch) | |
tree | 5f7f0e4f5749922ef883e6424e2eebc888832e7b /tools/perf/builtin-script.c | |
parent | dadafc315ded31a36cb4899bc85ef4050f0332a7 (diff) |
perf script: Use strtok_r() when parsing output field list
Just avoiding non-reentrant functions.
Cc: David Ahern <dsahern@gmail.com>
Link: http://lkml.kernel.org/n/tip-eqytykipd74epzl9aexvppcg@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-script.c')
-rw-r--r-- | tools/perf/builtin-script.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c index 46acc8ece41f..2dab70fba2ba 100644 --- a/tools/perf/builtin-script.c +++ b/tools/perf/builtin-script.c | |||
@@ -1708,7 +1708,7 @@ static int parse_scriptname(const struct option *opt __maybe_unused, | |||
1708 | static int parse_output_fields(const struct option *opt __maybe_unused, | 1708 | static int parse_output_fields(const struct option *opt __maybe_unused, |
1709 | const char *arg, int unset __maybe_unused) | 1709 | const char *arg, int unset __maybe_unused) |
1710 | { | 1710 | { |
1711 | char *tok; | 1711 | char *tok, *strtok_saveptr = NULL; |
1712 | int i, imax = ARRAY_SIZE(all_output_options); | 1712 | int i, imax = ARRAY_SIZE(all_output_options); |
1713 | int j; | 1713 | int j; |
1714 | int rc = 0; | 1714 | int rc = 0; |
@@ -1769,7 +1769,7 @@ static int parse_output_fields(const struct option *opt __maybe_unused, | |||
1769 | } | 1769 | } |
1770 | } | 1770 | } |
1771 | 1771 | ||
1772 | for (tok = strtok(tok, ","); tok; tok = strtok(NULL, ",")) { | 1772 | for (tok = strtok_r(tok, ",", &strtok_saveptr); tok; tok = strtok_r(NULL, ",", &strtok_saveptr)) { |
1773 | for (i = 0; i < imax; ++i) { | 1773 | for (i = 0; i < imax; ++i) { |
1774 | if (strcmp(tok, all_output_options[i].str) == 0) | 1774 | if (strcmp(tok, all_output_options[i].str) == 0) |
1775 | break; | 1775 | break; |