diff options
Diffstat (limited to 'ui/vnc.c')
-rw-r--r-- | ui/vnc.c | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -3205,29 +3205,24 @@ int vnc_display_pw_expire(const char *id, time_t expires) return 0; } -char *vnc_display_local_addr(const char *id) +static void vnc_display_print_local_addr(VncDisplay *vs) { - VncDisplay *vs = vnc_display_find(id); SocketAddress *addr; - char *ret; Error *err = NULL; - assert(vs); - addr = qio_channel_socket_get_local_address(vs->lsock, &err); if (!addr) { - return NULL; + return; } if (addr->type != SOCKET_ADDRESS_KIND_INET) { qapi_free_SocketAddress(addr); - return NULL; + return; } - ret = g_strdup_printf("%s:%s", addr->u.inet.data->host, - addr->u.inet.data->port); + error_printf_unless_qmp("VNC server running on %s:%s\n", + addr->u.inet.data->host, + addr->u.inet.data->port); qapi_free_SocketAddress(addr); - - return ret; } static QemuOptsList qemu_vnc_opts = { @@ -3513,6 +3508,7 @@ void vnc_display_open(const char *id, Error **errp) const char *vnc; char *h; const char *credid; + int show_vnc_port = 0; bool sasl = false; #ifdef CONFIG_VNC_SASL int saslErr; @@ -3592,6 +3588,7 @@ void vnc_display_open(const char *id, Error **errp) if (to) { inet->has_to = true; inet->to = to + 5900; + show_vnc_port = 1; } inet->ipv4 = ipv4; inet->has_ipv4 = has_ipv4; @@ -3836,6 +3833,10 @@ void vnc_display_open(const char *id, Error **errp) } } + if (show_vnc_port) { + vnc_display_print_local_addr(vs); + } + qapi_free_SocketAddress(saddr); qapi_free_SocketAddress(wsaddr); return; |