]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
Fixed bug in bug fix. Has to be tested now.
authorJens Kammler <jens.kammler@bertelsmann.de>
Sat, 16 Feb 2019 14:35:23 +0000 (15:35 +0100)
committerTobias Oetiker <tobi@oetiker.ch>
Wed, 6 Mar 2019 07:17:57 +0000 (08:17 +0100)
Forgot to increase proc_pdp_cnt after finishing most left open PDP.
Added check for invalid values before calculation, just to be sure.

src/rrd_update.c

index 0a3efb368b315bf6f102ff7447d7f4e3047cbc4f..4065da58b0be61182661167af16a12bca2f6d732 100644 (file)
@@ -1176,8 +1176,12 @@ static int process_arg(
 
                 /* assign ds-values proportionally to most left open PDP and all others */
                 for (unsigned int ds_idx = 0; ds_idx < rrd->stat_head->ds_cnt; ds_idx++) {
-                    open_pdp_new[ds_idx] = pdp_new[ds_idx] * (double) sec_open_pdp / interval;
-                    pdp_new[ds_idx] -= open_pdp_new[ds_idx];
+                    if(!isnan(pdp_new[ds_idx]) && interval > 0) {
+                        open_pdp_new[ds_idx] = pdp_new[ds_idx] * (double) sec_open_pdp / interval;
+                        pdp_new[ds_idx] -= open_pdp_new[ds_idx];
+                    } else {
+                        open_pdp_new[ds_idx] = DNAN;
+                    }
 
                     #ifdef DEBUG
                     fprintf(stderr, "Split values ds[%lu]\t"
@@ -1224,7 +1228,8 @@ static int process_arg(
                 /* modify times for processing remaining PDP's */
                 interval -= sec_open_pdp;
                 pre_int -= sec_open_pdp;
-                elapsed_pdp_st -= 1;
+                elapsed_pdp_st--;
+                proc_pdp_cnt++;
 
                 free(open_pdp_new);
             }