attach: use cleanup macros and logging helpers when fetching seccomp

parent a5d657d3
...@@ -566,8 +566,7 @@ static bool fetch_seccomp(struct lxc_container *c, lxc_attach_options_t *options ...@@ -566,8 +566,7 @@ static bool fetch_seccomp(struct lxc_container *c, lxc_attach_options_t *options
if (!(options->namespaces & CLONE_NEWNS) || if (!(options->namespaces & CLONE_NEWNS) ||
!(options->attach_flags & LXC_ATTACH_LSM)) { !(options->attach_flags & LXC_ATTACH_LSM)) {
free(c->lxc_conf->seccomp.seccomp); free_disarm(c->lxc_conf->seccomp.seccomp);
c->lxc_conf->seccomp.seccomp = NULL;
return true; return true;
} }
...@@ -582,10 +581,8 @@ static bool fetch_seccomp(struct lxc_container *c, lxc_attach_options_t *options ...@@ -582,10 +581,8 @@ static bool fetch_seccomp(struct lxc_container *c, lxc_attach_options_t *options
INFO("Failed to retrieve lxc.seccomp.profile"); INFO("Failed to retrieve lxc.seccomp.profile");
path = c->get_running_config_item(c, "lxc.seccomp"); path = c->get_running_config_item(c, "lxc.seccomp");
if (!path) { if (!path)
INFO("Failed to retrieve lxc.seccomp"); return log_info(true, "Failed to retrieve lxc.seccomp");
return true;
}
} }
/* Copy the value into the new lxc_conf. */ /* Copy the value into the new lxc_conf. */
...@@ -595,13 +592,10 @@ static bool fetch_seccomp(struct lxc_container *c, lxc_attach_options_t *options ...@@ -595,13 +592,10 @@ static bool fetch_seccomp(struct lxc_container *c, lxc_attach_options_t *options
/* Attempt to parse the resulting config. */ /* Attempt to parse the resulting config. */
ret = lxc_read_seccomp_config(c->lxc_conf); ret = lxc_read_seccomp_config(c->lxc_conf);
if (ret < 0) { if (ret < 0)
ERROR("Failed to retrieve seccomp policy"); return log_error(false, "Failed to retrieve seccomp policy");
return false;
}
INFO("Retrieved seccomp policy"); return log_info(true, "Retrieved seccomp policy");
return true;
} }
static bool no_new_privs(struct lxc_container *c, lxc_attach_options_t *options) static bool no_new_privs(struct lxc_container *c, lxc_attach_options_t *options)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment