Skip to content

Commit

Permalink
tools: lxc-freeze: add default log priority & cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: 2xsec <dh48.jeong@samsung.com>
  • Loading branch information
2xsec committed Aug 17, 2018
1 parent c2a23ef commit fe8c37e
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/lxc/tools/lxc_freeze.c
Expand Up @@ -41,18 +41,20 @@ static const struct option my_longopts[] = {
};

static struct lxc_arguments my_args = {
.progname = "lxc-freeze",
.help = "\
.progname = "lxc-freeze",
.help = "\
--name=NAME\n\
\n\
lxc-freeze freezes a container with the identifier NAME\n\
\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[])
Expand All @@ -63,18 +65,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) {
Expand Down

0 comments on commit fe8c37e

Please sign in to comment.