[lxc-devel] [lxc/master] tools: restore lxc-create log behavior

brauner on Github lxc-bot at linuxcontainers.org
Mon Jun 11 11:17:28 UTC 2018


A non-text attachment was scrubbed...
Name: not available
Type: text/x-mailbox
Size: 545 bytes
Desc: not available
URL: <http://lists.linuxcontainers.org/pipermail/lxc-devel/attachments/20180611/4ba34a8e/attachment.bin>
-------------- next part --------------
From 70cf33762530f36e8475504b4f764061b4513f92 Mon Sep 17 00:00:00 2001
From: Christian Brauner <christian.brauner at ubuntu.com>
Date: Mon, 11 Jun 2018 13:15:48 +0200
Subject: [PATCH] tools: restore lxc-create log behavior

Older versions of lxc-create used to set log_file to "none" when a log priority
but no log file was specified on the command line. Let's restore this behavior.

Closes #2392.

Signed-off-by: Christian Brauner <christian.brauner at ubuntu.com>
---
 src/lxc/tools/lxc_create.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/lxc/tools/lxc_create.c b/src/lxc/tools/lxc_create.c
index 3dd2e01b8..f8ec5ad2b 100644
--- a/src/lxc/tools/lxc_create.c
+++ b/src/lxc/tools/lxc_create.c
@@ -230,7 +230,10 @@ int main(int argc, char *argv[])
 	/* Only create log if explicitly instructed */
 	if (my_args.log_file || my_args.log_priority) {
 		log.name = my_args.name;
-		log.file = my_args.log_file;
+		if (!my_args.log_file)
+			log.file = "none";
+		else
+			log.file = my_args.log_file;
 		log.level = my_args.log_priority;
 		log.prefix = my_args.progname;
 		log.quiet = my_args.quiet;


More information about the lxc-devel mailing list