X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=ulog.c;h=b7300e720d21012ca60f96490cb24d91abd3efc5;hp=66aad90298909b215a530c534ee0da02276a84dc;hb=3b6181b63d80e77c04a52d7439a87850eea1fe78;hpb=d1c66ef1131d14f0ed197b368d03f71b964e45f8;ds=sidebyside diff --git a/ulog.c b/ulog.c index 66aad90..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; } } @@ -90,7 +91,7 @@ static void ulog_kmsg(int priority, const char *fmt, va_list ap) { FILE *kmsg; - if ((kmsg = fopen("/dev/kmsg", "w")) != NULL) { + if ((kmsg = fopen("/dev/kmsg", "r+")) != NULL) { fprintf(kmsg, "<%u>", priority); if (_ulog_ident)