Received: from eggs.gnu.org ([2001:4830:134:3::10]:54168) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDYRG-00031I-LV for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:38:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bDYRE-0008PV-0R for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:38:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:39219) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bDYRD-0008PR-Qr for qemu-devel@nongnu.org; Thu, 16 Jun 2016 10:38:31 -0400 Date: Thu, 16 Jun 2016 11:38:29 -0300 From: Eduardo Habkost Message-ID: <20160616143829.GI18662@thinpad.lan.raisama.net> References: <1466042350-13373-1-git-send-email-chao.p.peng@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1466042350-13373-1-git-send-email-chao.p.peng@linux.intel.com> Subject: Re: [Qemu-devel] [PATCH] vnc: wrap vnc initialization code with CONFIG_VNC List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Chao Peng Cc: qemu-devel@nongnu.org, Paolo Bonzini On Thu, Jun 16, 2016 at 09:59:10AM +0800, Chao Peng wrote: > 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. We can apply this fix now and then consider alternative ways to avoid the #ifdef. Reviewed-by: Eduardo Habkost Applied to my machine-next branch. Thanks! > --- > 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 > -- Eduardo