]> git.proxmox.com Git - mirror_lxc.git/commitdiff
confile: set_config_no_new_privs()
authorChristian Brauner <christian.brauner@ubuntu.com>
Tue, 8 Dec 2020 16:15:44 +0000 (17:15 +0100)
committerChristian Brauner <christian.brauner@ubuntu.com>
Tue, 8 Dec 2020 16:15:44 +0000 (17:15 +0100)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/confile.c

index 2d6da17460b09ff687d4c7794188d0f2ca9a1127..90a452d1986a14ffe1056f9b97cc7913c4e45345 100644 (file)
@@ -3480,6 +3480,7 @@ static int set_config_log_syslog(const char *key, const char *value,
 static int set_config_no_new_privs(const char *key, const char *value,
                                   struct lxc_conf *lxc_conf, void *data)
 {
+       int ret;
        unsigned int v;
 
        if (lxc_config_value_empty(value)) {
@@ -3487,11 +3488,12 @@ static int set_config_no_new_privs(const char *key, const char *value,
                return 0;
        }
 
-       if (lxc_safe_uint(value, &v) < 0)
-               return -1;
+       ret = lxc_safe_uint(value, &v);
+       if (ret < 0)
+               return ret;
 
        if (v > 1)
-               return -1;
+               return ret_errno(EINVAL);
 
        lxc_conf->no_new_privs = v ? true : false;