aboutsummaryrefslogtreecommitdiffstats
path: root/tools/console
diff options
context:
space:
mode:
authorKeir Fraser <keir.fraser@citrix.com>2010-02-08 08:50:03 +0000
committerKeir Fraser <keir.fraser@citrix.com>2010-02-08 08:50:03 +0000
commit2f98a8cad0104408eb0fa36b87d7d474d9e98792 (patch)
treeb954a3fcba548604faa96aab1bd43929e59ff1b2 /tools/console
parent8e2626b7d79f20772cc913c39e42f817bced4fc5 (diff)
downloadxen-2f98a8cad0104408eb0fa36b87d7d474d9e98792.tar.gz
xen-2f98a8cad0104408eb0fa36b87d7d474d9e98792.tar.bz2
xen-2f98a8cad0104408eb0fa36b87d7d474d9e98792.zip
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 <yuzg@cn.fujitsu.com>
Diffstat (limited to 'tools/console')
-rw-r--r--tools/console/client/main.c8
1 files changed, 7 insertions, 1 deletions
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]);