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=17897f0d8b4366a795197e01d7272a14e473cee6;p=rrdtool.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/program@1171 a5681a0c-68f1-0310-ab6d-d61299d08faa --- diff --git a/src/rrd_update.c b/src/rrd_update.c index 7a73fdf..d301399 100644 --- a/src/rrd_update.c +++ b/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 */