mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-04 00:03:54 -06:00
qtest: Don't segfault with invalid -qtest option
This prints an error message, instead of core dump, when "-qtest" option value is invalid, e.g.: $ ./x86_64-softmmu/qemu-system-x86_64 -qtest unknown qemu-system-x86_64: Failed to initialize device for qtest: "unknown" Signed-off-by: Fam Zheng <famz@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
This commit is contained in:
parent
1f9c4cfda4
commit
23802b4fe0
3 changed files with 16 additions and 3 deletions
8
vl.c
8
vl.c
|
@ -4078,7 +4078,13 @@ int main(int argc, char **argv, char **envp)
|
|||
configure_accelerator();
|
||||
|
||||
if (qtest_chrdev) {
|
||||
qtest_init(qtest_chrdev, qtest_log);
|
||||
Error *local_err = NULL;
|
||||
qtest_init(qtest_chrdev, qtest_log, &local_err);
|
||||
if (local_err) {
|
||||
error_report("%s", error_get_pretty(local_err));
|
||||
error_free(local_err);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
machine_opts = qemu_get_machine_opts();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue