[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 24/31] vl: Clean up error reporting in vnc_init_func
From: |
Markus Armbruster |
Subject: |
[Qemu-devel] [PATCH 24/31] vl: Clean up error reporting in vnc_init_func() |
Date: |
Mon, 8 Oct 2018 19:31:18 +0200 |
Calling error_report() in a function that takes an Error ** argument
is suspicious. vnc_init_func() does that, and then fails without
setting an error. Its caller main(), via qemu_opts_foreach(), is fine
with it, but clean it up anyway.
Cc: Gerd Hoffmann <address@hidden>
Signed-off-by: Markus Armbruster <address@hidden>
---
ui/vnc.c | 5 +++--
vl.c | 2 +-
2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/ui/vnc.c b/ui/vnc.c
index cf221c83cc..df6c84b802 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -4082,8 +4082,9 @@ int vnc_init_func(void *opaque, QemuOpts *opts, Error
**errp)
vnc_display_init(id);
vnc_display_open(id, &local_err);
if (local_err != NULL) {
- error_reportf_err(local_err, "Failed to start VNC server: ");
- exit(1);
+ error_propagate(errp, local_err);
+ error_prepend(errp, "Failed to start VNC server: ");
+ return -1;
}
return 0;
}
diff --git a/vl.c b/vl.c
index 86eee4c798..5c159ca45c 100644
--- a/vl.c
+++ b/vl.c
@@ -4479,7 +4479,7 @@ int main(int argc, char **argv, char **envp)
/* init remote displays */
#ifdef CONFIG_VNC
qemu_opts_foreach(qemu_find_opts("vnc"),
- vnc_init_func, NULL, NULL);
+ vnc_init_func, NULL, &error_fatal);
#endif
if (using_spice) {
--
2.17.1
- [Qemu-devel] [PATCH 00/31] Replace some unwise uses of error_report() & friends, Markus Armbruster, 2018/10/08
- [Qemu-devel] [PATCH 11/31] migration: Fix !replay_can_snapshot() error handling, Markus Armbruster, 2018/10/08
- [Qemu-devel] [PATCH 23/31] vl: Clean up error reporting in device_init_func(), Markus Armbruster, 2018/10/08
- [Qemu-devel] [PATCH 24/31] vl: Clean up error reporting in vnc_init_func(),
Markus Armbruster <=
- [Qemu-devel] [PATCH 21/31] vl: Clean up error reporting in mon_init_func(), Markus Armbruster, 2018/10/08
- [Qemu-devel] [PATCH 18/31] qom: Clean up error reporting in user_creatable_add_opts_foreach(), Markus Armbruster, 2018/10/08
- [Qemu-devel] [PATCH 08/31] pc: Fix machine property nvdimm-persistence error handling, Markus Armbruster, 2018/10/08