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

Andrey Vagin avagin at openvz.org
Tue Jan 20 12:20:15 PST 2015


For example:
$ criu show stats-dump
Error (crtools.c:468): Unable to handle more than one command

$ ./criu show -f stats-dump
dump: {
	freezing_time: 626
	frozen_time: 24762
	memdump_time: 2696
	memwrite_time: 1007
	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