[CRIU] [PATCH] crtools: init logfile after processing all command line arguments

Ruslan Kuprieiev kupruser at gmail.com
Sun Nov 10 18:35:13 PST 2013


I see no need now to init log during processing of command line arguments.

Signed-off-by: Ruslan Kuprieiev <kupruser at gmail.com>
---
 crtools.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/crtools.c b/crtools.c
index 1a4ed9e..33aba0d 100644
--- a/crtools.c
+++ b/crtools.c
@@ -77,7 +77,6 @@ int main(int argc, char *argv[])
 	pid_t pid = 0, tree_id = 0;
 	int ret = -1;
 	int opt, idx;
-	int log_inited = 0;
 	int log_level = 0;
 	char *images_dir = ".";
 
@@ -168,9 +167,6 @@ int main(int argc, char *argv[])
 			break;
 		case 'o':
 			opts.output = optarg;
-			if (log_init(optarg))
-				return -1;
-			log_inited = 1;
 			break;
 		case 'n':
 			if (parse_ns_string(optarg))
@@ -283,11 +279,8 @@ int main(int argc, char *argv[])
 
 	log_set_loglevel(log_level);
 
-	if (!log_inited) {
-		ret = log_init(NULL);
-		if (ret)
-			return ret;
-	}
+	if (log_init(opts.output))
+		return -1;
 
 	if (chdir(images_dir)) {
 		pr_perror("Can't change directory to %s", images_dir);
-- 
1.8.1.2



More information about the CRIU mailing list