Small fix to vlan range check
authorIdo Barnea <[email protected]>
Mon, 27 Mar 2017 15:11:00 +0000 (18:11 +0300)
committerIdo Barnea <[email protected]>
Mon, 27 Mar 2017 15:11:00 +0000 (18:11 +0300)
Signed-off-by: Ido Barnea <[email protected]>
src/utl_yaml.cpp

index 0073e6f..04bc06a 100755 (executable)
@@ -65,11 +65,13 @@ bool utl_yaml_read_uint16(const YAML::Node& node,
                           uint16_t & val, uint16_t min, uint16_t max) {
     bool res = utl_yaml_read_uint16(node, name, val);
 
-    if ((val < min) || (val > max)) {
-        fprintf(stderr
-                , "Parsing error: value of field '%s' must be between %d and %d\n"
-                , name.c_str(), min, max);
-        exit(1);
+    if (res) {
+        if ((val < min) || (val > max)) {
+            fprintf(stderr
+                    , "Parsing error: value of field '%s' must be between %d and %d\n"
+                    , name.c_str(), min, max);
+            exit(1);
+        }
     }
 
     return res;