From a663fbd9e2f65fae81018d81f231ad79510cf9fb Mon Sep 17 00:00:00 2001 From: Chao Peng Date: Thu, 16 Jun 2016 09:59:10 +0800 Subject: [PATCH] vnc: Wrap vnc initialization code with CONFIG_VNC commit f8c75b2486 (vnc: Initialization stubs) removed CONFIG_VNC in vl.c code. However qemu_find_opts("vnc") is NULL when vnc is configured out. Crash will happen in qemu_opts_foreach() before stub vnc_init_func() is called. This patch add it back. Cc: Eduardo Habkost Reviewed-by: Eduardo Habkost Signed-off-by: Chao Peng Signed-off-by: Eduardo Habkost --- vl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vl.c b/vl.c index 0736d8430d..2f63eb448f 100644 --- a/vl.c +++ b/vl.c @@ -4564,8 +4564,10 @@ int main(int argc, char **argv, char **envp) os_setup_signal_handling(); /* init remote displays */ +#ifdef CONFIG_VNC qemu_opts_foreach(qemu_find_opts("vnc"), vnc_init_func, NULL, NULL); +#endif if (show_vnc_port) { char *ret = vnc_display_local_addr("default"); printf("VNC server running on '%s'\n", ret);