From 2f98a8cad0104408eb0fa36b87d7d474d9e98792 Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Mon, 8 Feb 2010 08:50:03 +0000 Subject: tools/xenconsole: fix Segmentation fault Segmentation fault occurs if DOMID isn't specified. Some check be added to output error message in this situation. Signed-off-by: Yu Zhiguo --- tools/console/client/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tools/console') diff --git a/tools/console/client/main.c b/tools/console/client/main.c index 63e729acab..840f08eec6 100644 --- a/tools/console/client/main.c +++ b/tools/console/client/main.c @@ -287,7 +287,13 @@ int main(int argc, char **argv) exit(EINVAL); } } - + + if (optind >= argc) { + fprintf(stderr, "DOMID should be specified\n"); + fprintf(stderr, "Try `%s --help' for more information.\n", + argv[0]); + exit(EINVAL); + } domid = strtol(argv[optind], &end, 10); if (end && *end) { fprintf(stderr, "Invalid DOMID `%s'\n", argv[optind]); -- cgit v1.2.3