[CRIU] [PATCH 1/2] criu: make work_dir part of cr_options

Mike Rapoport rppt at linux.vnet.ibm.com
Sun Jun 19 06:35:25 PDT 2016


Signed-off-by: Mike Rapoport <rppt at linux.vnet.ibm.com>
---
 criu/crtools.c            | 11 +++++------
 criu/include/cr_options.h |  1 +
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/criu/crtools.c b/criu/crtools.c
index 9bef1d8..0102730 100644
--- a/criu/crtools.c
+++ b/criu/crtools.c
@@ -258,7 +258,6 @@ int main(int argc, char *argv[], char *envp[])
 	int opt, idx;
 	int log_level = LOG_UNSET;
 	char *imgs_dir = ".";
-	char *work_dir = NULL;
 	static const char short_opts[] = "dSsRf:F:t:p:hcD:o:v::x::Vr:jJ:lW:L:M:";
 	static struct option long_opts[] = {
 		{ "tree",			required_argument,	0, 't'	},
@@ -409,7 +408,7 @@ int main(int argc, char *argv[], char *envp[])
 			imgs_dir = optarg;
 			break;
 		case 'W':
-			work_dir = optarg;
+			opts.work_dir = optarg;
 			break;
 		case 'o':
 			opts.output = optarg;
@@ -668,8 +667,8 @@ int main(int argc, char *argv[], char *envp[])
 		return 1;
 	}
 
-	if (work_dir == NULL)
-		work_dir = imgs_dir;
+	if (opts.work_dir == NULL)
+		opts.work_dir = imgs_dir;
 
 	if (optind >= argc) {
 		pr_msg("Error: command is required\n");
@@ -716,8 +715,8 @@ int main(int argc, char *argv[], char *envp[])
 			opts.shell_job)
 		pr_warn("Stopped and detached shell job will get SIGHUP from OS.");
 
-	if (chdir(work_dir)) {
-		pr_perror("Can't change directory to %s", work_dir);
+	if (chdir(opts.work_dir)) {
+		pr_perror("Can't change directory to %s", opts.work_dir);
 		return 1;
 	}
 
diff --git a/criu/include/cr_options.h b/criu/include/cr_options.h
index 1d47909..f6de39e 100644
--- a/criu/include/cr_options.h
+++ b/criu/include/cr_options.h
@@ -112,6 +112,7 @@ struct cr_options {
 	unsigned int		empty_ns;
 	bool			lazy_pages;
 	bool			tcp_skip_in_flight;
+	char			*work_dir;
 };
 
 extern struct cr_options opts;
-- 
1.9.1



More information about the CRIU mailing list