]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
confile_utils: cleanup set_config_bool_item()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 9 Dec 2020 08:59:32 +0000 (09:59 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 10 Dec 2020 19:39:52 +0000 (20:39 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile_utils.c

index 562b18317f52034ebd257c2046d9fb8ad8ecfe47..42d274c35353982805a4465d1744d1c512820f61 100644 (file)
@@ -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)