qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] monitor: vnc: Fix compilation error if CONFIG_VNC i


From: Julio Montes
Subject: [Qemu-devel] [PATCH] monitor: vnc: Fix compilation error if CONFIG_VNC is disable
Date: Tue, 2 Jul 2019 19:01:31 +0000

How to reproduce it?
===

```
$ ./configure --disable-spice --disable-vte --disable-vnc \
    --disable-vnc-jpeg --disable-vnc-png --disable-vnc-sasl
$ make
...
monitor/hmp-cmds.c: In function ‘hmp_change’:
monitor/hmp-cmds.c:1985:17: error: unused variable ‘hmp_mon’
     [-Werror=unused-variable]
     MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
```

Fix
===

Move `hmp_mon` variable within the `CONFIG_VNC` block

Signed-off-by: Julio Montes <address@hidden>
---
 monitor/hmp-cmds.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/monitor/hmp-cmds.c b/monitor/hmp-cmds.c
index 9de35387c3..5ed564683e 100644
--- a/monitor/hmp-cmds.c
+++ b/monitor/hmp-cmds.c
@@ -1982,7 +1982,6 @@ static void hmp_change_read_arg(void *opaque, const char 
*password,
 
 void hmp_change(Monitor *mon, const QDict *qdict)
 {
-    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
     const char *device = qdict_get_str(qdict, "device");
     const char *target = qdict_get_str(qdict, "target");
     const char *arg = qdict_get_try_str(qdict, "arg");
@@ -1991,6 +1990,7 @@ void hmp_change(Monitor *mon, const QDict *qdict)
     Error *err = NULL;
 
 #ifdef CONFIG_VNC
+    MonitorHMP *hmp_mon = container_of(mon, MonitorHMP, common);
     if (strcmp(device, "vnc") == 0) {
         if (read_only) {
             monitor_printf(mon,
-- 
2.17.2




reply via email to

[Prev in Thread] Current Thread [Next in Thread]