]> git.ipfire.org Git - thirdparty/lxc.git/commitdiff
tools: lxc-unfreeze: add default log priority & cleanups 2544/head
author2xsec <dh48.jeong@samsung.com>
Fri, 17 Aug 2018 16:42:15 +0000 (01:42 +0900)
committer2xsec <dh48.jeong@samsung.com>
Fri, 17 Aug 2018 16:42:15 +0000 (01:42 +0900)
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
src/lxc/tools/lxc_unfreeze.c

index a0b56900f3480d5a5165b0a8c39ee35fee6ffdab..7a9972c4c296cbaf008717d794e44ec075ca5fe4 100644 (file)
@@ -40,8 +40,8 @@ static const struct option my_longopts[] = {
 };
 
 static struct lxc_arguments my_args = {
-       .progname = "lxc-unfreeze",
-       .help     = "\
+       .progname     = "lxc-unfreeze",
+       .help         = "\
 --name=NAME\n\
 \n\
 lxc-unfreeze unfreezes a container with the identifier NAME\n\
@@ -49,9 +49,11 @@ lxc-unfreeze unfreezes a container with the identifier NAME\n\
 Options :\n\
   -n, --name=NAME   NAME of the container\n\
   --rcfile=FILE     Load configuration file FILE\n",
-       .options  = my_longopts,
-       .parser   = NULL,
-       .checker  = NULL,
+       .options      = my_longopts,
+       .parser       = NULL,
+       .checker      = NULL,
+       .log_priority = "ERROR",
+       .log_file     = "none",
 };
 
 int main(int argc, char *argv[])
@@ -62,18 +64,15 @@ int main(int argc, char *argv[])
        if (lxc_arguments_parse(&my_args, argc, argv))
                exit(EXIT_FAILURE);
 
-       /* 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;
-               log.level = my_args.log_priority;
-               log.prefix = my_args.progname;
-               log.quiet = my_args.quiet;
-               log.lxcpath = my_args.lxcpath[0];
+       log.name = my_args.name;
+       log.file = my_args.log_file;
+       log.level = my_args.log_priority;
+       log.prefix = my_args.progname;
+       log.quiet = my_args.quiet;
+       log.lxcpath = my_args.lxcpath[0];
 
-               if (lxc_log_init(&log))
-                       exit(EXIT_FAILURE);
-       }
+       if (lxc_log_init(&log))
+               exit(EXIT_FAILURE);
 
        c = lxc_container_new(my_args.name, my_args.lxcpath[0]);
        if (!c) {