aboutsummaryrefslogtreecommitdiff
path: root/vl.c
diff options
context:
space:
mode:
authorFam Zheng <famz@redhat.com>2014-02-10 09:28:02 +0800
committerAndreas Färber <afaerber@suse.de>2014-02-14 21:12:01 +0100
commit23802b4fe0cf5821b72aa5bc682e38c8c91bb168 (patch)
treea3baf7fff29cfac745b81dc49ccb1bfa5055b300 /vl.c
parent1f9c4cfda4df7c442255f9492a2408d80df1d42a (diff)
downloadqemu-23802b4fe0cf5821b72aa5bc682e38c8c91bb168.zip
qemu-23802b4fe0cf5821b72aa5bc682e38c8c91bb168.tar.gz
qemu-23802b4fe0cf5821b72aa5bc682e38c8c91bb168.tar.bz2
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>
Diffstat (limited to 'vl.c')
-rw-r--r--vl.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/vl.c b/vl.c
index a7b00cd..0f7d31f 100644
--- a/vl.c
+++ b/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();