criu: return an error if arguments contains more than one command

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@gmail.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin 2015-01-22 18:57:39 +03:00 committed by Pavel Emelyanov
parent 63cb8b4da8
commit b025ef1dbc

View file

@ -463,6 +463,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 */