From: Christian Brauner Date: Wed, 11 Jul 2018 21:40:16 +0000 (+0200) Subject: attach: cleanup no_new_privs() X-Git-Tag: lxc-3.1.0~211^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bcbef73392726f432b9c8275dab986ed4420f793;p=thirdparty%2Flxc.git attach: cleanup no_new_privs() Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index a8dd0bff6..9b886af3c 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -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)