From 3882bdf76fee23a105de8f1946d8fdbdbc9dd111 Mon Sep 17 00:00:00 2001 From: Jens Kammler Date: Sat, 16 Feb 2019 15:35:23 +0100 Subject: [PATCH] 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. --- src/rrd_update.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) 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); } -- 2.47.2