From: Christian Brauner Date: Wed, 9 Dec 2020 08:59:32 +0000 (+0100) Subject: confile_utils: cleanup set_config_bool_item() X-Git-Tag: lxc-5.0.0~330^2~27 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4f3de2ac120e2ba2234efa77fcb78906162904f7;p=thirdparty%2Flxc.git confile_utils: cleanup set_config_bool_item() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/confile_utils.c b/src/lxc/confile_utils.c index 562b18317..42d274c35 100644 --- a/src/lxc/confile_utils.c +++ b/src/lxc/confile_utils.c @@ -655,6 +655,7 @@ int set_config_path_item(char **conf_item, const char *value) int set_config_bool_item(bool *conf_item, const char *value, bool empty_conf_action) { + int ret; unsigned int val = 0; if (lxc_config_value_empty(value)) { @@ -662,8 +663,9 @@ int set_config_bool_item(bool *conf_item, const char *value, bool empty_conf_act return 0; } - if (lxc_safe_uint(value, &val) < 0) - return -EINVAL; + ret = lxc_safe_uint(value, &val); + if (ret < 0) + return ret; switch (val) { case 0: @@ -674,7 +676,7 @@ int set_config_bool_item(bool *conf_item, const char *value, bool empty_conf_act return 0; } - return -EINVAL; + return ret_errno(EINVAL); } int config_ip_prefix(struct in_addr *addr)