]> git.itanic.dy.fi Git - rrdd/commitdiff
rrdtool: Fix bug with messed up log printing
authorTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 14 Mar 2020 09:31:10 +0000 (11:31 +0200)
committerTimo Kokkonen <timo.t.kokkonen@iki.fi>
Sat, 14 Mar 2020 09:31:10 +0000 (11:31 +0200)
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 <timo.t.kokkonen@iki.fi>
rrdtool.c

index 5b7d3acebf064f8d51d2d70e7d6767274215ed70..7c0646d835e075d36af6c86ef881e842724dc007 100644 (file)
--- 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) {