Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lkl: follow up fixes for strtok_r/strtok_s usage #321

Merged
merged 1 commit into from
Feb 12, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions tools/lkl/lib/net.c
Original file line number Diff line number Diff line change
Expand Up @@ -577,17 +577,18 @@ int lkl_qdisc_add(int ifindex, char *root, char *type)
*/
void lkl_qdisc_parse_add(int ifindex, char *entries)
{
char *token = NULL;
char *saveptr = NULL, *token = NULL;
char *root = NULL, *type = NULL;
int ret = 0;

for (token = strtok(entries, ";"); token; token = strtok(NULL, ";")) {
for (token = strtok_r(entries, ";", &saveptr); token;
token = strtok_r(NULL, ";", &saveptr)) {
root = strtok(token, "|");
type = strtok(NULL, "|");
ret = lkl_qdisc_add(ifindex, root, type);
if (ret) {
fprintf(stderr, "Failed to add qdisc entry: %s\n",
lkl_strerror(ret));
lkl_printf("Failed to add qdisc entry: %s\n",
lkl_strerror(ret));
return;
}
}
Expand Down