From: Christian Brauner Date: Tue, 5 Dec 2017 23:16:38 +0000 (+0100) Subject: start: set loglevel correctly X-Git-Tag: lxc-2.0.10~522 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=91e46cb162eccc3d7dcfa391d75a3cca34189014;p=thirdparty%2Flxc.git start: set loglevel correctly We want the loglevel that the user specified when starting the container because it overrides the default one set in the config. Closes #2003. Reported-by: Felix Abecassis Signed-off-by: Christian Brauner --- diff --git a/src/lxc/start.c b/src/lxc/start.c index b3d2afa6a..541bce66e 100644 --- a/src/lxc/start.c +++ b/src/lxc/start.c @@ -592,6 +592,7 @@ on_error: int lxc_init(const char *name, struct lxc_handler *handler) { + const char *loglevel; struct lxc_conf *conf = handler->conf; lsm_init(); @@ -632,8 +633,9 @@ int lxc_init(const char *name, struct lxc_handler *handler) if (setenv("LXC_CGNS_AWARE", "1", 1)) SYSERROR("Failed to set environment variable LXC_CGNS_AWARE=1."); - if (setenv("LXC_LOG_LEVEL", lxc_log_priority_to_string(handler->conf->loglevel), 1)) - SYSERROR("Failed to set environment variable LXC_CGNS_AWARE=1."); + loglevel = lxc_log_priority_to_string(lxc_log_get_level()); + if (setenv("LXC_LOG_LEVEL", loglevel, 1)) + SYSERROR("Failed to set environment variable LXC_LOG_LEVEL=%s", loglevel); /* End of environment variable setup for hooks. */ TRACE("set environment variables");