Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.openwrt.org/project/libubox.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/ulog.c
diff options
context:
space:
mode:
authorRosen Penev <rosenp@gmail.com>2016-12-22 22:53:25 +0300
committerFelix Fietkau <nbd@nbd.name>2016-12-24 13:03:29 +0300
commit8fc1c3053e1cdaa341a6009e18eced821f1eda3e (patch)
tree66d62e0c7db2edfc8fedcde31620c75e77417f91 /ulog.c
parent4a9f74f7ae6c092c731969c93f90ab4d6a07b524 (diff)
libubox: replace strtok with _r version.
_r is re-entrant. Also happens to silence a cppcheck warning. Signed-off by: Rosen Penev <rosenp@gmail.com>
Diffstat (limited to 'ulog.c')
-rw-r--r--ulog.c5
1 files 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;
}
}