aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorAndreas Färber <andreas.faerber@web.de>2011-11-10 16:35:32 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-11-11 08:27:06 -0600
commitd423675c94442dadb4bd751dac876385960ce109 (patch)
treeed64a301b7298cc7d26dd3af536116c8768f9329 /vl.c
parent0e3b800e71cb7759d099eabbd8ad4c4fe848e381 (diff)
vl.c: Fail gracefully if no machine is found
machine defaults to find_default_machine(), then gets overridden via -M and machine_parse(). If no -M is specified and find_default_machine() returns NULL (when no machine compiled in), exit with an error. Avoids a segfault when setting machine->max_cpus. Signed-off-by: Andreas Färber <andreas.faerber@web.de> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/vl.c b/vl.c
index f169aac1f9..16fa222f1a 100644
--- a/vl.c
+++ b/vl.c
@@ -3089,6 +3089,11 @@ int main(int argc, char **argv, char **envp)
data_dir = CONFIG_QEMU_DATADIR;
}
+ if (machine == NULL) {
+ fprintf(stderr, "No machine found.\n");
+ exit(1);
+ }
+
/*
* Default to max_cpus = smp_cpus, in case the user doesn't
* specify a max_cpus value.