From patchwork Mon Feb 4 10:40:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tokarev X-Patchwork-Id: 218035 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 52F6E2C02AB for ; Tue, 5 Feb 2013 05:51:11 +1100 (EST) Received: from localhost ([::1]:46768 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2Jbh-0004t0-CR for incoming@patchwork.ozlabs.org; Mon, 04 Feb 2013 05:49:01 -0500 Received: from eggs.gnu.org ([208.118.235.92]:52395) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2JbU-0004iP-FB for qemu-devel@nongnu.org; Mon, 04 Feb 2013 05:48:50 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1U2JbQ-0002va-Rs for qemu-devel@nongnu.org; Mon, 04 Feb 2013 05:48:48 -0500 Received: from isrv.corpit.ru ([86.62.121.231]:48273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1U2JbQ-0002v1-LM; Mon, 04 Feb 2013 05:48:44 -0500 Received: from gandalf.tls.msk.ru (mjt.vpn.tls.msk.ru [192.168.177.99]) by isrv.corpit.ru (Postfix) with ESMTP id F3CCAA03F8; Mon, 4 Feb 2013 14:48:43 +0400 (MSK) Received: by gandalf.tls.msk.ru (Postfix, from userid 1000) id 7B017529; Mon, 4 Feb 2013 14:41:27 +0400 (MSK) From: Michael Tokarev To: qemu-devel@nongnu.org Date: Mon, 4 Feb 2013 14:40:31 +0400 Message-Id: <1359974470-17044-22-git-send-email-mjt@msgid.tls.msk.ru> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1359974470-17044-1-git-send-email-mjt@msgid.tls.msk.ru> References: <1359974470-17044-1-git-send-email-mjt@msgid.tls.msk.ru> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 86.62.121.231 Cc: Paolo Bonzini , Michael Tokarev , qemu-stable@nongnu.org, Stefan Hajnoczi Subject: [Qemu-devel] [PATCH 21/60] vnc: fix "info vnc" with "-vnc ..., reverse=on" X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org From: Paolo Bonzini When reverse connection is in use, there is no active VNC server socket. Because of this, getsockopt(-1, ...) is attempted and the following error is emitted: $ socat TCP-LISTEN:5900,reuseaddr TCP-LISTEN:5901,reuseaddr & $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc An undefined error has occurred Because however the host, family, service and auth fields are optional, we can just exit if there is no active server socket. $ x86_64-softmmu/qemu-system-x86_64 -vnc localhost:5900,reverse -monitor stdio QEMU 1.2.50 monitor - type 'help' for more information (qemu) info vnc Server: Client: address: 127.0.0.1:5900 x509_dname: none username: none Signed-off-by: Paolo Bonzini Signed-off-by: Stefan Hajnoczi (cherry picked from commit 417b0b88904fe1dd8c41bff8092dfbab0134d9cb) Signed-off-by: Michael Tokarev --- ui/vnc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ui/vnc.c b/ui/vnc.c index 8cec55f..a61e569 100644 --- a/ui/vnc.c +++ b/ui/vnc.c @@ -371,6 +371,10 @@ VncInfo *qmp_query_vnc(Error **errp) } } + if (vnc_display->lsock == -1) { + return info; + } + if (getsockname(vnc_display->lsock, (struct sockaddr *)&sa, &salen) == -1) { error_set(errp, QERR_UNDEFINED_ERROR);