index 5179c71623c78b73f18a25fd809510882ea8c922..9d4765c1f0ad82a5f0e42a18218dfbe8396c2c91 100644 (file)
--- a/program/src/rrd_fetch.c
+++ b/program/src/rrd_fetch.c
/*****************************************************************************
- * RRDtool 1.2.21 Copyright by Tobi Oetiker, 1997-2007
+ * RRDtool 1.2.28 Copyright by Tobi Oetiker, 1997-2008
*****************************************************************************
* rrd_fetch.c read date from an rrd to use for further processing
*****************************************************************************
tmp_step_diff = labs(*step - (rrd.stat_head->pdp_step
* rrd.rra_def[i].pdp_cnt));
/* best full match */
- if(cal_end >= *end
- && cal_start <= *start){
+ if(cal_start <= *start){
if (first_full || (tmp_step_diff < best_full_step_diff)){
first_full=0;
best_full_step_diff = tmp_step_diff;
tmp_match = full_match;
if (cal_start>*start)
tmp_match -= (cal_start-*start);
- if (cal_end<*end)
- tmp_match -= (*end-cal_end);
if (first_part ||
(best_match < tmp_match) ||
(best_match == tmp_match &&
#endif
/* fill the gap at the start if needs be */
-
- if (start_offset <= 0)
- rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1;
- else
- rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1+start_offset;
+ if (*start <= rra_end_time && *end >= rra_start_time - *step){
+
+ if (start_offset <= 0)
+ rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1;
+ else
+ rra_pointer = rrd.rra_ptr[chosen_rra].cur_row+1+start_offset;
- if(fseek(in_file,(rra_base
+ if(fseek(in_file,(rra_base
+ (rra_pointer
* *ds_cnt
* sizeof(rrd_value_t))),SEEK_SET) != 0){
- rrd_set_error("seek error in RRA");
- for (i=0;(unsigned)i<*ds_cnt;i++)
- free((*ds_namv)[i]);
- free(*ds_namv);
- rrd_free(&rrd);
- free(*data);
- *data = NULL;
- fclose(in_file);
- return(-1);
-
- }
+ rrd_set_error("seek error in RRA");
+ for (i=0;(unsigned)i<*ds_cnt;i++)
+ free((*ds_namv)[i]);
+ free(*ds_namv);
+ rrd_free(&rrd);
+ free(*data);
+ *data = NULL;
+ fclose(in_file);
+ return(-1);
+
+ }
#ifdef DEBUG
- fprintf(stderr,"First Seek: rra_base %lu rra_pointer %lu\n",
- rra_base, rra_pointer);
+ fprintf(stderr,"First Seek: rra_base %lu rra_pointer %lu\n",
+ rra_base, rra_pointer);
#endif
+ }
+
/* step trough the array */
for (i=start_offset;