From 8fc1c3053e1cdaa341a6009e18eced821f1eda3e Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Thu, 22 Dec 2016 11:53:25 -0800 Subject: [PATCH] libubox: replace strtok with _r version. _r is re-entrant. Also happens to silence a cppcheck warning. Signed-off by: Rosen Penev --- ulog.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ulog.c b/ulog.c index 296605d..b7300e7 100644 --- a/ulog.c +++ b/ulog.c @@ -35,12 +35,13 @@ static const char *ulog_default_ident(void) FILE *self; static char line[64]; char *p = NULL; + char *sbuf; if ((self = fopen("/proc/self/status", "r")) != NULL) { while (fgets(line, sizeof(line), self)) { if (!strncmp(line, "Name:", 5)) { - strtok(line, "\t\n"); - p = strtok(NULL, "\t\n"); + strtok_r(line, "\t\n", &sbuf); + p = strtok_r(NULL, "\t\n", &sbuf); break; } } -- 2.25.1