From 49a5c0c3b9dbb91e3cdd97b2975a3e12c53fe73e Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Wed, 17 Oct 2012 11:29:45 +0200 Subject: imklog: skip leading spaces in kernel timestamp --- plugins/imklog/bsd.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins/imklog/bsd.c') diff --git a/plugins/imklog/bsd.c b/plugins/imklog/bsd.c index eaf8e5ca..428d3cc2 100644 --- a/plugins/imklog/bsd.c +++ b/plugins/imklog/bsd.c @@ -92,7 +92,9 @@ submitSyslog(int pri, uchar *buf) /* we now try to parse the timestamp. iff it parses, we assume * it is a timestamp. Otherwise we know for sure it is no ts ;) */ - i = 4; /* first digit after '[' */ + i = 4; /* space or first digit after '[' */ + while(buf[i] && isspace(buf[i])) + ++i; /* skip space */ secs = 0; while(buf[i] && isdigit(buf[i])) { secs = secs * 10 + buf[i] - '0'; -- cgit v1.2.3 From 51754401f72376ea5f1c5b74b9c1772ab6f7ae4f Mon Sep 17 00:00:00 2001 From: Marius Tomaschewski Date: Wed, 17 Oct 2012 11:55:34 +0200 Subject: imklog: use memmove to remove kernel timestamp --- plugins/imklog/bsd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'plugins/imklog/bsd.c') diff --git a/plugins/imklog/bsd.c b/plugins/imklog/bsd.c index 428d3cc2..bb45c97a 100644 --- a/plugins/imklog/bsd.c +++ b/plugins/imklog/bsd.c @@ -120,7 +120,7 @@ submitSyslog(int pri, uchar *buf) /* we have a timestamp */ DBGPRINTF("kernel timestamp is %ld %ld\n", secs, nsecs); bufsize= strlen((char*)buf); - memcpy(buf+3, buf+i, bufsize - i + 1); + memmove(buf+3, buf+i, bufsize - i + 1); clock_gettime(CLOCK_MONOTONIC, &monotonic); clock_gettime(CLOCK_REALTIME, &realtime); -- cgit v1.2.3