Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 49346e85 authored by Arnaldo Carvalho de Melo's avatar Arnaldo Carvalho de Melo
Browse files

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: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent dadafc31
Loading
Loading
Loading
Loading
+2 −2
Original line number Original line Diff line number Diff line
@@ -1708,7 +1708,7 @@ static int parse_scriptname(const struct option *opt __maybe_unused,
static int parse_output_fields(const struct option *opt __maybe_unused,
static int parse_output_fields(const struct option *opt __maybe_unused,
			    const char *arg, int unset __maybe_unused)
			    const char *arg, int unset __maybe_unused)
{
{
	char *tok;
	char *tok, *strtok_saveptr = NULL;
	int i, imax = ARRAY_SIZE(all_output_options);
	int i, imax = ARRAY_SIZE(all_output_options);
	int j;
	int j;
	int rc = 0;
	int rc = 0;
@@ -1769,7 +1769,7 @@ static int parse_output_fields(const struct option *opt __maybe_unused,
		}
		}
	}
	}


	for (tok = strtok(tok, ","); tok; tok = strtok(NULL, ",")) {
	for (tok = strtok_r(tok, ",", &strtok_saveptr); tok; tok = strtok_r(NULL, ",", &strtok_saveptr)) {
		for (i = 0; i < imax; ++i) {
		for (i = 0; i < imax; ++i) {
			if (strcmp(tok, all_output_options[i].str) == 0)
			if (strcmp(tok, all_output_options[i].str) == 0)
				break;
				break;