]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
fix trendnan variable access
authorTobias Oetiker <tobi@oetiker.ch>
Sat, 10 Nov 2012 16:48:16 +0000 (17:48 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Sat, 10 Nov 2012 16:48:16 +0000 (17:48 +0100)
src/rrd_rpncalc.c

index ab01c8ad12aed2687e1b2325fe6a0f504709e488..1e76ee5d803f88e2cca688712e24529252b3fe0c 100644 (file)
@@ -887,7 +887,9 @@ short rpn_calc(
                 if (output_idx + 1 >= (int) ceil((float) dur / (float) step)) {
                     int       ignorenan = (rpnp[rpi].op == OP_TREND);
                     double    accum = 0.0;
-                    int       i = 0;
+                    int       i = -1; /* pick the current entries, not the next one
+                                         as the data pointer has already been forwarded
+                                         when the OP_VARIABLE was processed */
                     int       count = 0;
 
                     do {