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

index b3d776014db408b149101d6511e2e460a0fda72f..78127d59714a4ce716b3f14591093a967465a31c 100644 (file)
@@ -886,7 +886,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 {