--- rrdtool-1.2.11/src/rrd_fetch.c.orig	Mon Sep  5 10:42:09 2005
+++ rrdtool-1.2.11/src/rrd_fetch.c	Mon Sep  5 10:42:21 2005
@@ -182,7 +182,7 @@
     int            first_part = 1;
     rrd_t     rrd;
     rrd_value_t    *data_ptr;
-    unsigned long  rows = (*end - *start) / *step;
+    unsigned long  rows = (*end - *start) / *step +1;
 
 #ifdef DEBUG
 fprintf(stderr,"Entered rrd_fetch_fn() searching for the best match\n");
@@ -295,7 +295,7 @@
     *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",
