diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-18 09:01:01 +0200 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2012-10-23 13:54:56 +0200 |
commit | 007fcd3ee9673b3d00baacf3765bd501296155cd (patch) | |
tree | 108ad32fc0bb1dfde71f5d1c9e5c75114e246672 /ui/vnc.c | |
parent | 1ce52c78ab90c4303bcb110f2c614410386d79a2 (diff) |
vnc: reorganize code for reverse mode
Avoid the dance between csock and vs->lsock.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'ui/vnc.c')
-rw-r--r-- | ui/vnc.c | 20 |
1 files changed, 9 insertions, 11 deletions
@@ -3053,19 +3053,17 @@ int vnc_display_open(DisplayState *ds, const char *display) if (reverse) { /* connect to viewer */ - if (strncmp(display, "unix:", 5) == 0) - vs->lsock = unix_connect(display+5, NULL); - else - vs->lsock = inet_connect(display, NULL); - if (vs->lsock < 0) { - goto fail; + int csock; + vs->lsock = -1; + if (strncmp(display, "unix:", 5) == 0) { + csock = unix_connect(display+5, NULL); } else { - int csock = vs->lsock; - vs->lsock = -1; - vnc_connect(vs, csock, 0); + csock = inet_connect(display, NULL); } - return 0; - + if (csock < 0) { + goto fail; + } + vnc_connect(vs, csock, 0); } else { /* listen for connects */ char *dpy; |