qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] vnc: fix "info vnc" with "-vnc ..., reverse=on"
@ 2012-10-10 12:30 Paolo Bonzini
  2012-10-12  8:55 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
  2012-10-16  6:33 ` [Qemu-devel] " Michael Tokarev
  0 siblings, 2 replies; 3+ messages in thread
From: Paolo Bonzini @ 2012-10-10 12:30 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-trivial

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 <pbonzini@redhat.com>
---
 ui/vnc.c | 4 ++++
 1 file modificato, 4 inserzioni(+)

diff --git a/ui/vnc.c b/ui/vnc.c
index b8e46ca..44d00a2 100644
--- a/ui/vnc.c
+++ b/ui/vnc.c
@@ -372,6 +372,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);
-- 
1.7.12.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-10-16  6:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-10 12:30 [Qemu-devel] [PATCH] vnc: fix "info vnc" with "-vnc ..., reverse=on" Paolo Bonzini
2012-10-12  8:55 ` [Qemu-devel] [Qemu-trivial] " Stefan Hajnoczi
2012-10-16  6:33 ` [Qemu-devel] " Michael Tokarev

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).