[CRIU] [PATCH] crtools: init log after changing directory to work_dir
Ruslan Kuprieiev
kupruser at gmail.com
Tue Nov 19 14:38:09 PST 2013
After set of patches which add --work-dir option we have an issue: logs are created relatively
to current dir and not relatively to images dir(which is work dir, when --work-dir is not given).
To solve this lets init log after chdir(work_dir)
Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
crtools.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/crtools.c b/crtools.c
index b680236..7c723a0 100644
--- a/crtools.c
+++ b/crtools.c
@@ -285,11 +285,6 @@ int main(int argc, char *argv[])
if (work_dir == NULL)
work_dir = imgs_dir;
- log_set_loglevel(log_level);
-
- if (log_init(opts.output))
- return -1;
-
if (opts.img_parent)
pr_info("Will do snapshot from %s\n", opts.img_parent);
@@ -310,6 +305,11 @@ int main(int argc, char *argv[])
return -1;
}
+ log_set_loglevel(log_level);
+
+ if (log_init(opts.output))
+ return -1;
+
if (!strcmp(argv[optind], "dump")) {
if (!tree_id)
goto opt_pid_missing;
--
1.8.1.2
More information about the CRIU
mailing list