From ef0e68b125856810a0ae5c5c5714b6d873f8c519 Mon Sep 17 00:00:00 2001 From: oetiker Date: Sun, 18 Sep 2005 16:59:34 +0000 Subject: [PATCH] allocate memory for one more row ... fetch can not return 0 reows ... git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@683 a5681a0c-68f1-0310-ab6d-d61299d08faa --- src/rrd_fetch.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/rrd_fetch.c b/src/rrd_fetch.c index 9bcaeb1..e6590ec 100644 --- a/src/rrd_fetch.c +++ b/src/rrd_fetch.c @@ -182,12 +182,12 @@ rrd_fetch_fn( int first_part = 1; rrd_t rrd; rrd_value_t *data_ptr; - unsigned long rows = (*end - *start) / *step; + unsigned long rows; #ifdef DEBUG fprintf(stderr,"Entered rrd_fetch_fn() searching for the best match\n"); -fprintf(stderr,"Looking for: start %10lu end %10lu step %5lu rows %lu\n", - *start,*end,*step,rows); +fprintf(stderr,"Looking for: start %10lu end %10lu step %5lu\n", + *start,*end,*step); #endif if(rrd_open(filename,&in_file,&rrd, RRD_READONLY)==-1) @@ -295,7 +295,7 @@ fprintf(stderr,"partial match, not best\n"); *step = rrd.stat_head->pdp_step * rrd.rra_def[chosen_rra].pdp_cnt; *start -= (*start % *step); if (*end % *step) *end += (*step - *end % *step); - rows = (*end - *start) / *step; + rows = (*end - *start) / *step + 1; #ifdef DEBUG fprintf(stderr,"We found: start %10lu end %10lu step %5lu rows %lu\n", -- 2.11.0