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: 's avatarChristian Brauner <christian.brauner@ubuntu.com>
parent 776bb08b
...@@ -213,10 +213,12 @@ int main(int argc, char *argv[]) ...@@ -213,10 +213,12 @@ int main(int argc, char *argv[])
if (lxc_arguments_parse(&my_args, argc, argv)) if (lxc_arguments_parse(&my_args, argc, argv))
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
if (!my_args.log_file) /* Only create log if explicitly instructed */
my_args.log_file = "none"; if (my_args.log_file || my_args.log_priority) {
log.name = my_args.name; log.name = my_args.name;
if (!my_args.log_file)
log.file = "none";
else
log.file = my_args.log_file; log.file = my_args.log_file;
log.level = my_args.log_priority; log.level = my_args.log_priority;
log.prefix = my_args.progname; log.prefix = my_args.progname;
...@@ -225,7 +227,7 @@ int main(int argc, char *argv[]) ...@@ -225,7 +227,7 @@ int main(int argc, char *argv[])
if (lxc_log_init(&log)) if (lxc_log_init(&log))
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
lxc_log_options_no_override(); }
if (!my_args.template) { if (!my_args.template) {
fprintf(stderr, "A template must be specified.\n"); fprintf(stderr, "A template must be specified.\n");
......
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