]> git.ipfire.org Git - thirdparty/rrdtool-1.x.git/commitdiff
argument parser regression fix - if no explicit reduce function is set, use the one...
authorTobias Oetiker <tobi@oetiker.ch>
Wed, 23 Oct 2013 17:06:58 +0000 (19:06 +0200)
committerTobias Oetiker <tobi@oetiker.ch>
Wed, 23 Oct 2013 17:06:58 +0000 (19:06 +0200)
src/rrd_graph.c
src/rrd_graph.h
src/rrd_graph_helper.c

index d2049a9577499c7d3df5c9b41b3e1f5d7df59ee2..12033e6d4ddd1951fbee324ad0b67918f4875c2f 100644 (file)
@@ -941,7 +941,8 @@ int data_fetch(
                chart and visibility of data will be random */            
             im->gdes[i].step = max(im->gdes[i].step,im->step);
             if (ft_step < im->gdes[i].step) {
-                reduce_data(im->gdes[i].cf_reduce,
+                
+                reduce_data(im->gdes[i].cf_reduce_set ? im->gdes[i].cf_reduce : im->gdes[i].cf,
                             ft_step,
                             &im->gdes[i].start,
                             &im->gdes[i].end,
@@ -4035,6 +4036,7 @@ int gdes_alloc(
     im->gdes[im->gdes_c - 1].rrd[0] = '\0';
     im->gdes[im->gdes_c - 1].ds = -1;
     im->gdes[im->gdes_c - 1].cf_reduce = CF_AVERAGE;
+    im->gdes[im->gdes_c - 1].cf_reduce_set = 0;    
     im->gdes[im->gdes_c - 1].cf = CF_AVERAGE;
     im->gdes[im->gdes_c - 1].yrule = DNAN;
     im->gdes[im->gdes_c - 1].xrule = 0;
index 18718bae84c7f5923bae54c49d8118470cd6be9d..eca79e2eddca7bf31b1f4852bbf884c2eba1f2b1 100644 (file)
@@ -207,6 +207,7 @@ typedef struct graph_desc_t {
     char      daemon[256];
     enum cf_en cf;      /* consolidation function */
     enum cf_en cf_reduce;   /* consolidation function for reduce_data() */
+    int        cf_reduce_set; /* is the cf_reduce option set */
     struct gfx_color_t col, col2; /* graph color */
        double    gradheight;
     char      format[FMT_LEG_LEN + 5];  /* format for PRINT AND GPRINT */
index 6be6f8e7d240c2f4b2819a6656b7b92080c23577..cb4ac9c9acf91b2276d94f9038d72f1eca3cb03e 100644 (file)
@@ -470,6 +470,7 @@ static graph_desc_t* newGraphDescription(image_desc_t *const im,enum gf_en gf,pa
     char *reduce=getKeyValueArgument("reduce",1,pa);
     if (reduce) { 
       gdp->cf_reduce=cf_conv(reduce);
+      gdp->cf_reduce_set=1;
       dprintfparsed("got reduce: %s (%i)\n",reduce,gdp->cf_reduce);
       if (((int)gdp->cf_reduce)==-1) { rrd_set_error("bad reduce CF: %s",reduce); return NULL; }
     }
@@ -867,7 +868,7 @@ int parse_def(enum gf_en gf,parsedargs_t*pa,image_desc_t *const im){
                                        ); 
   if (gdp->step == 0){
       gdp->step = im->step; /* initialize with image wide step */
-  }
+  }  
   if (!gdp) { return 1;}
   /* debugging output */
   dprintf("=================================\n");