From e2dabbb0edbebc6e107ed8e8c385fa624ed79a04 Mon Sep 17 00:00:00 2001 From: Timo Kokkonen Date: Sat, 14 Mar 2020 11:31:10 +0200 Subject: [PATCH] rrdtool: Fix bug with messed up log printing Commit 3d128efe07 forgot to take account update data strings no longer start with "N:", but with a unix timestamp and ":". This messed up the logs. Fix it by parsing up to the first colon and stripping the timestamp away. Signed-off-by: Timo Kokkonen --- rrdtool.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rrdtool.c b/rrdtool.c index 5b7d3ac..7c0646d 100644 --- a/rrdtool.c +++ b/rrdtool.c @@ -222,7 +222,11 @@ static int write_to_logfile(struct rrd_database *rrd, const char *data) str_ptr = logstr + strlen(logstr); - data += 2; /* Skip the "N: part */ + /* Skip the "N: part */ + while (*data != ':') + data++; + data++; + spacing = 12; while (*data && str_ptr - logstr < sizeof(logstr) - 1) { -- 2.45.0