[LEDE-DEV] [PATCH] libubox: replace strtok with strsep
Rosen Penev
rosenp at gmail.com
Tue Dec 13 21:43:32 PST 2016
strsep is re-entrant whereas strtok not necessarily so.
Signed-off by: Rosen Penev <rosenp at gmail.com>
---
ulog.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ulog.c b/ulog.c
index 296605d..985d366 100644
--- a/ulog.c
+++ b/ulog.c
@@ -39,8 +39,8 @@ static const char *ulog_default_ident(void)
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");
+ strsep(&line, "\t\n");
+ p = strsep(&line, "\t\n");
break;
}
}
--
2.8.3
More information about the Lede-dev
mailing list