[CRIU] [PATCH] criu: return an error if arguments contains more than one command

Andrey Vagin avagin at openvz.org
Tue Jan 20 04:44:48 PST 2015


For example:
Error (crtools.c:449): Unable to handle more than one command
dump: {
	freezing_time: 862
	frozen_time: 24298
	memdump_time: 3188
	memwrite_time: 1487
	pages_scanned: 1108
	pages_skipped_parent: 0
	pages_written: 28
	irmap_resolve: 0
}

Reported-by: Thouraya TH <thouraya87 at gmail.com>
Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 crtools.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/crtools.c b/crtools.c
index 7c8b6ac..fb60e66 100644
--- a/crtools.c
+++ b/crtools.c
@@ -464,6 +464,9 @@ int main(int argc, char *argv[], char *envp[])
 		opts.exec_cmd = xmalloc((argc - optind) * sizeof(char *));
 		memcpy(opts.exec_cmd, &argv[optind + 1], (argc - optind - 1) * sizeof(char *));
 		opts.exec_cmd[argc - optind - 1] = NULL;
+	} else if (optind + 1 != argc) {
+		pr_err("Unable to handle more than one command\n");
+		goto usage;
 	}
 
 	/* We must not open imgs dir, if service is called */
-- 
1.9.3



More information about the CRIU mailing list