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>
This commit is contained in:
parent
4a9f74f7ae
commit
8fc1c3053e
1 changed files with 3 additions and 2 deletions
5
ulog.c
5
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;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue