[rrd-developers] src/rrd_update.c line 637

Stanislav Sinyagin ssinyagin at yahoo.com
Wed Mar 10 11:26:33 MET 2004


Hi, 

In rrd_update.c from current snapshot:

                case DST_COUNTER:
                case DST_DERIVE:
                    if(rrd.pdp_prep[i].last_ds[0] != 'U'){
                      for(ii=0;updvals[i+1][ii] != '\0';ii++){
                            if(updvals[i+1][ii] < '0' || updvals[i+1][ii] > '9'
|| (ii==0 && updvals[i+1][ii] == '-')){
                                 rrd_set_error("not a simple integer: '%s'",updv
als[i+1]);
                                 break;
                            }
                       }


First of all, why do we limit DERIVE to positive values only? 
I don't know if there are applications for that, but isn't this designed for 
counters that may decrease?

Second, once you check a symbol that it's less than '0' or more than '9', 
the third condition that checks against '-' will be never met, and can be removed.

Third, I'd suggest a more explanative error message:
 "Value must be a nonnegative integer"

Cheers,
Stan

--
Unsubscribe mailto:rrd-developers-request at list.ee.ethz.ch?subject=unsubscribe
Help        mailto:rrd-developers-request at list.ee.ethz.ch?subject=help
Archive     http://www.ee.ethz.ch/~slist/rrd-developers
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi



More information about the rrd-developers mailing list