mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 16:23:55 -06:00
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>
This commit is contained in:
parent
0e3b800e71
commit
d423675c94
1 changed files with 5 additions and 0 deletions
5
vl.c
5
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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue