diff options
author | Rosen Penev <rosenp@gmail.com> | 2016-12-22 22:53:25 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@nbd.name> | 2016-12-24 13:03:29 +0300 |
commit | 8fc1c3053e1cdaa341a6009e18eced821f1eda3e (patch) | |
tree | 66d62e0c7db2edfc8fedcde31620c75e77417f91 /ulog.c | |
parent | 4a9f74f7ae6c092c731969c93f90ab4d6a07b524 (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.c | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -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; } } |