From: Christian Brauner Date: Sat, 30 Jan 2021 16:07:55 +0000 (+0100) Subject: attach: don't needless check for NULL X-Git-Tag: lxc-5.0.0~312^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=640952e53838c7a05535c9e015a67e533a355795;p=thirdparty%2Flxc.git attach: don't needless check for NULL Signed-off-by: Christian Brauner --- diff --git a/src/lxc/attach.c b/src/lxc/attach.c index 8a42e6ce4..ed0f08e40 100644 --- a/src/lxc/attach.c +++ b/src/lxc/attach.c @@ -476,7 +476,7 @@ static int lxc_attach_set_environment(struct attach_context *ctx, return log_warn(-1, "Failed to set environment variable"); /* Set container environment variables.*/ - if (ctx && ctx->container && ctx->container->lxc_conf) { + if (ctx->container->lxc_conf) { lxc_list_for_each(iterator, &ctx->container->lxc_conf->environment) { char *env_tmp; @@ -929,8 +929,7 @@ __noreturn static void do_attach(struct attach_payload *ap) TRACE("Set %s LSM label to \"%s\"", ctx->lsm_ops->name, ctx->lsm_label); } - if ((ctx->container && conf && conf->no_new_privs) || - (options->attach_flags & LXC_ATTACH_NO_NEW_PRIVS)) { + if (conf->no_new_privs || (options->attach_flags & LXC_ATTACH_NO_NEW_PRIVS)) { ret = prctl(PR_SET_NO_NEW_PRIVS, prctl_arg(1), prctl_arg(0), prctl_arg(0), prctl_arg(0)); if (ret < 0) @@ -939,7 +938,7 @@ __noreturn static void do_attach(struct attach_payload *ap) TRACE("Set PR_SET_NO_NEW_PRIVS"); } - if (ctx->container && conf && conf->seccomp.seccomp) { + if (conf->seccomp.seccomp) { ret = lxc_seccomp_load(conf); if (ret < 0) goto on_error;