From: Jens Kammler Date: Sat, 16 Feb 2019 14:35:23 +0000 (+0100) Subject: Fixed bug in bug fix. Has to be tested now. X-Git-Tag: v1.7.2~34 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3882bdf76fee23a105de8f1946d8fdbdbc9dd111;p=thirdparty%2Frrdtool-1.x.git Fixed bug in bug fix. Has to be tested now. Forgot to increase proc_pdp_cnt after finishing most left open PDP. Added check for invalid values before calculation, just to be sure. --- diff --git a/src/rrd_update.c b/src/rrd_update.c index 0a3efb36..4065da58 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -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); }