[lxc-devel] [lxc/master] lxc_execute.c: Only create logs after checking for lcx_config
marcosps on Github
lxc-bot at linuxcontainers.org
Thu Feb 8 23:33:31 UTC 2018
A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 520 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180208/12c3606d/attachment.bin>
-------------- next part --------------
From f2df7ca4ea6a1d55f524302a3d9062a112f5b065 Mon Sep 17 00:00:00 2001
From: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
Date: Thu, 8 Feb 2018 21:27:16 -0200
Subject: [PATCH] lxc_execute.c: Only create logs after checking for lcx_config
As lxc_container_new shows errors in stderr, we can safely create the
logs after lxc_conf ensures that LXC have a configuration file.
Fixes: #2032
Signed-off-by: Marcos Paulo de Souza <marcos.souza.org at gmail.com>
---
src/lxc/tools/lxc_execute.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/lxc/tools/lxc_execute.c b/src/lxc/tools/lxc_execute.c
index 3348d7c1c..17569d4a2 100644
--- a/src/lxc/tools/lxc_execute.c
+++ b/src/lxc/tools/lxc_execute.c
@@ -154,10 +154,6 @@ int main(int argc, char *argv[])
log.quiet = my_args.quiet;
log.lxcpath = my_args.lxcpath[0];
- if (lxc_log_init(&log))
- exit(EXIT_FAILURE);
- lxc_log_options_no_override();
-
/* REMOVE IN LXC 3.0 */
setenv("LXC_UPDATE_CONFIG_FORMAT", "1", 0);
@@ -188,6 +184,10 @@ int main(int argc, char *argv[])
exit(EXIT_FAILURE);
}
+ if (lxc_log_init(&log))
+ exit(EXIT_FAILURE);
+ lxc_log_options_no_override();
+
if (my_args.argc == 0) {
if (!set_argv(c->lxc_conf, &my_args)) {
fprintf(stderr, "missing command to execute!\n");
More information about the lxc-devel
mailing list