qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vnc: wrap vnc initialization code with CONFIG_VNC
@ 2016-06-16  1:59 Chao Peng
  2016-06-16 14:38 ` Eduardo Habkost
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Peng @ 2016-06-16  1:59 UTC (permalink / raw)
  To: qemu-devel; +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 <ehabkost@redhat.com>
Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
---
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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Qemu-devel] [PATCH] vnc: wrap vnc initialization code with CONFIG_VNC
  2016-06-16  1:59 [Qemu-devel] [PATCH] vnc: wrap vnc initialization code with CONFIG_VNC Chao Peng
@ 2016-06-16 14:38 ` Eduardo Habkost
  0 siblings, 0 replies; 2+ messages in thread
From: Eduardo Habkost @ 2016-06-16 14:38 UTC (permalink / raw)
  To: Chao Peng; +Cc: qemu-devel, 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 <ehabkost@redhat.com>
> Signed-off-by: Chao Peng <chao.p.peng@linux.intel.com>
> ---
> 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 <ehabkost@redhat.com>

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-06-16 14:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-06-16  1:59 [Qemu-devel] [PATCH] vnc: wrap vnc initialization code with CONFIG_VNC Chao Peng
2016-06-16 14:38 ` Eduardo Habkost

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).