Patchwork [4/5] vnc: add a is_vnc_active() helper

login
register
mail settings
Submitter Amit Shah
Date Sept. 11, 2009, 3:52 p.m.
Message ID <1252684353-25067-5-git-send-email-amit.shah@redhat.com>
Download mbox | patch
Permalink /patch/33474/
State Superseded
Headers show

Comments

Amit Shah - Sept. 11, 2009, 3:52 p.m.
This helper is introduced to query the status of vnc.

Signed-off-by: Amit Shah <amit.shah@redhat.com>
---
 vnc.c |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)

Patch

diff --git a/vnc.c b/vnc.c
index 5eaef6a..ff2d4a8 100644
--- a/vnc.c
+++ b/vnc.c
@@ -178,9 +178,17 @@  static void do_info_vnc_client(Monitor *mon, VncState *client)
 #endif
 }
 
-void do_info_vnc(Monitor *mon)
+static 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",