From: oetiker Date: Wed, 25 Jul 2007 20:32:31 +0000 (+0000) Subject: check if intput is integer in any case not only when the previouse value wave != U X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b284813732f6d9af0c3a5fc97bd4a546717680e6;p=rrdtool-all.git check if intput is integer in any case not only when the previouse value wave != U git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2@1171 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/program/src/rrd_update.c b/program/src/rrd_update.c index 7a73fdfa..d3013996 100644 --- a/program/src/rrd_update.c +++ b/program/src/rrd_update.c @@ -620,16 +620,16 @@ _rrd_update(const char *filename, const char *tmplt, int argc, const char **argv switch(dst_idx){ case DST_COUNTER: case DST_DERIVE: + 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'",updvals[i+1]); + break; + } + } + if (rrd_test_error()){ + break; + } 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'",updvals[i+1]); - break; - } - } - if (rrd_test_error()){ - break; - } pdp_new[i]= rrd_diff(updvals[i+1],rrd.pdp_prep[i].last_ds); if(dst_idx == DST_COUNTER) { /* simple overflow catcher suggested by Andres Kroonmaa */