[CRIU] [PATCH] crtools: add addr string to opts.

Ruslan Kuprieiev kupruser at gmail.com
Thu Aug 8 08:13:48 EDT 2013


Hello!

Added char * addr field to struct cr_options. It will be used as socket
address in cr_service(). addr is properly converted into ps_addr if 
"page-server" command is set.

-- 
Signed-off-by: Ruslan Kuprieiev kupruser at gmail.com

-------------- next part --------------
diff --git a/crtools.c b/crtools.c
index 51d188a..ce0bcda 100644
--- a/crtools.c
+++ b/crtools.c
@@ -235,10 +235,7 @@ int main(int argc, char *argv[])
 			opts.use_page_server = true;
 			break;
 		case 51:
-			if (!inet_aton(optarg, &opts.ps_addr.sin_addr)) {
-				pr_perror("Bad address");
-				return -1;
-			}
+			opts.addr = strdup(optarg);
 			break;
 		case 52:
 			opts.ps_addr.sin_port = htons(atoi(optarg));
@@ -334,8 +331,13 @@ int main(int argc, char *argv[])
 		return cr_exec(pid, argv + optind + 1);
 	}
 
-	if (!strcmp(argv[optind], "page-server"))
+	if (!strcmp(argv[optind], "page-server")) {
+		if (!inet_aton(opts.addr, &opts.ps_addr.sin_addr)) {
+			pr_perror("Bad address");
+			return -1;
+		}
 		return cr_page_server(opts.restore_detach);
+	}
 
 	pr_msg("Unknown command \"%s\"\n", argv[optind]);
 usage:
diff --git a/include/crtools.h b/include/crtools.h
index 81e89e1..da832f2 100644
--- a/include/crtools.h
+++ b/include/crtools.h
@@ -41,6 +41,7 @@ struct cr_options {
 	struct list_head	scripts;
 	bool			use_page_server;
 	struct sockaddr_in	ps_addr;
+	char			*addr;
 	bool			track_mem;
 	char			*img_parent;
 };


More information about the CRIU mailing list