Code

check if intput is integer in any case not only when the previouse value wave != U
authoroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 25 Jul 2007 20:32:31 +0000 (20:32 +0000)
committeroetiker <oetiker@a5681a0c-68f1-0310-ab6d-d61299d08faa>
Wed, 25 Jul 2007 20:32:31 +0000 (20:32 +0000)
git-svn-id: svn://svn.oetiker.ch/rrdtool/branches/1.2/program@1171 a5681a0c-68f1-0310-ab6d-d61299d08faa

src/rrd_update.c

index 7a73fdfa2600e53c79685bb68ab6516ab48693f8..d3013996951baa19843a0a2ef109631cde90d8b6 100644 (file)
@@ -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 */