summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIdo Barnea <ibarnea@cisco.com>2017-03-27 18:11:00 +0300
committerIdo Barnea <ibarnea@cisco.com>2017-03-27 18:11:00 +0300
commit0d4868d6e803a918da601db902064641c92dd686 (patch)
tree29423abc71cc2aeeae07836be8a7abc445121aa9
parentcd40180b7fec113926e00d9eb8fc60db1b8d9d9c (diff)
Small fix to vlan range check
Signed-off-by: Ido Barnea <ibarnea@cisco.com>
-rwxr-xr-xsrc/utl_yaml.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/utl_yaml.cpp b/src/utl_yaml.cpp
index 0073e6f4..04bc06ad 100755
--- a/src/utl_yaml.cpp
+++ b/src/utl_yaml.cpp
@@ -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;