From: Amit Shah Subject: [PATCH 4/5] vnc: add a is_vnc_active() helper Date: Wed, 9 Sep 2009 13:42:04 +0530 Message-ID: <1252483925-26336-6-git-send-email-amit.shah@redhat.com> References: <1252483925-26336-1-git-send-email-amit.shah@redhat.com> <1252483925-26336-2-git-send-email-amit.shah@redhat.com> <1252483925-26336-3-git-send-email-amit.shah@redhat.com> <1252483925-26336-4-git-send-email-amit.shah@redhat.com> <1252483925-26336-5-git-send-email-amit.shah@redhat.com> Cc: Amit Shah To: qemu-devel@nongnu.org, kvm@vger.kernel.org, virtualization@lists.linux-foundation.org Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46569 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752684AbZIIIMw (ORCPT ); Wed, 9 Sep 2009 04:12:52 -0400 In-Reply-To: <1252483925-26336-5-git-send-email-amit.shah@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: This helper is introduced to query the status of vnc. Signed-off-by: Amit Shah --- vnc.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletions(-) 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", -- 1.6.2.5