]> git.proxmox.com Git - mirror_lxc.git/commitdiff
attach: cleanup no_new_privs()
authorChristian Brauner <christian.brauner@ubuntu.com>
Wed, 11 Jul 2018 21:40:16 +0000 (23:40 +0200)
committerChristian Brauner <christian.brauner@ubuntu.com>
Thu, 12 Jul 2018 11:06:45 +0000 (13:06 +0200)
Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
src/lxc/attach.c

index a8dd0bff643d478d595e6886cf507a4b53c236b3..9b886af3c5fb5b048396b8b4b42b1955336a5232 100644 (file)
@@ -692,27 +692,26 @@ static bool fetch_seccomp(struct lxc_container *c, lxc_attach_options_t *options
 
 static bool no_new_privs(struct lxc_container *c, lxc_attach_options_t *options)
 {
+       bool bret;
        char *val;
 
        /* Remove current setting. */
-       if (!c->set_config_item(c, "lxc.no_new_privs", ""))
+       if (!c->set_config_item(c, "lxc.no_new_privs", "")) {
+               INFO("Failed to unset lxc.no_new_privs");
                return false;
+       }
 
        /* Retrieve currently active setting. */
        val = c->get_running_config_item(c, "lxc.no_new_privs");
        if (!val) {
-               INFO("Failed to get running config item for lxc.no_new_privs.");
+               INFO("Failed to retrieve lxc.no_new_privs");
                return false;
        }
 
        /* Set currently active setting. */
-       if (!c->set_config_item(c, "lxc.no_new_privs", val)) {
-               free(val);
-               return false;
-       }
+       bret = c->set_config_item(c, "lxc.no_new_privs", val);
        free(val);
-
-       return true;
+       return bret;
 }
 
 static signed long get_personality(const char *name, const char *lxcpath)