From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:39094) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDMku-0001Md-Tl for qemu-devel@nongnu.org; Wed, 15 Jun 2016 22:10:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDMkq-0001An-Mn for qemu-devel@nongnu.org; Wed, 15 Jun 2016 22:10:03 -0400 Received: from mga09.intel.com ([134.134.136.24]:50862) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDMkq-0001AU-Go for qemu-devel@nongnu.org; Wed, 15 Jun 2016 22:10:00 -0400 From: Chao Peng Date: Thu, 16 Jun 2016 09:59:10 +0800 Message-Id: <1466042350-13373-1-git-send-email-chao.p.peng@linux.intel.com> Subject: [Qemu-devel] [PATCH] vnc: wrap vnc initialization code with CONFIG_VNC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: Paolo Bonzini , Eduardo Habkost 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 Signed-off-by: Chao Peng --- Note: Of course there is other ways to fix it (e.g. check against NULL). I feel comfortable in any way. --- vl.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/vl.c b/vl.c index 45eff56..2088491 100644 --- a/vl.c +++ b/vl.c @@ -4557,8 +4557,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); -- 1.8.3.1