@@ -176,9 +176,17 @@ static void do_info_vnc_client(Monitor *mon, VncState *client)
#endif
}
-void do_info_vnc(Monitor *mon)
+int is_vnc_active(void)
{
if (vnc_display == NULL || vnc_display->display == NULL) {
+ return 0;
+ }
+ return 1;
+}
+
+void do_info_vnc(Monitor *mon)
+{
+ if (!is_vnc_active()) {
monitor_printf(mon, "Server: disabled\n");
} else {
char *serverAddr = vnc_socket_local_addr(" address: %s:%s\n",
@@ -313,7 +313,7 @@ void buffer_append(Buffer *buffer, const void *data, size_t len);
/* Misc helpers */
+int is_vnc_active(void);
char *vnc_socket_local_addr(const char *format, int fd);
char *vnc_socket_remote_addr(const char *format, int fd);
-
#endif /* __QEMU_VNC_H */
This helper is introduced to query the status of vnc. Signed-off-by: Amit Shah <amit.shah@redhat.com> --- vnc.c | 10 +++++++++- vnc.h | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-)