Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
smap: Return default on failure in smap_get_int/ullong.
Currently smap_get_int/ullong doesn't check any conversion errors. Most implementations of atoi/strtoull return 0 in case of failure. This leads to returning zero in case of wrongly set database values. For example, commands ovs-vsctl set interface iface options:key=\"\" ovs-vsctl set interface iface options:key=qwe123 ovs-vsctl set interface iface options:key=abc will have exactly same effect as ovs-vsctl set interface iface options:key=0 in case where 'key' is an integer option of the iface. Can be checked with 'other_config:emc-insert-inv-prob' or other integer 'options' and 'other_config's. 0 could be not a default and not safe value for many options and it'll be better to return default value instead if any. Conversion functions from 'util' library used to provide proper error handling. Signed-off-by: Ilya Maximets <[email protected]> Signed-off-by: Ben Pfaff <[email protected]> Tested-by: Jan Scheurich <[email protected]> Acked-by: Jan Scheurich <[email protected]>
- Loading branch information