qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] Strip brackets from vnc host


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] Strip brackets from vnc host
Date: Mon, 27 Apr 2015 08:44:08 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 04/27/2015 06:06 AM, Ján Tomko wrote:
> Commit v2.2.0-1530-ge556032 vnc: switch to inet_listen_opts
> bypassed the use of inet_parse in inet_listen, making literal
> IPv6 addresses enclosed in brackets fail:
> 
> qemu-kvm: -vnc [::1]:0: Failed to start VNC server on `(null)': address
> resolution failed for [::1]:5900: Name or service not known
> 
> Strip the brackets to make it work again.
> 
> Signed-off-by: Ján Tomko <address@hidden>
> ---
>  ui/vnc.c | 9 ++++++++-
>  1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/ui/vnc.c b/ui/vnc.c
> index cffb5b7..49af7c7 100644
> --- a/ui/vnc.c
> +++ b/ui/vnc.c
> @@ -3482,7 +3482,14 @@ void vnc_display_open(const char *id, Error **errp)
>  
>      h = strrchr(vnc, ':');
>      if (h) {
> -        char *host = g_strndup(vnc, h - vnc);
> +        char *host;
> +        size_t hlen = h - vnc;
> +
> +        if (vnc[0] == '[' && vnc[hlen-1] == ']') {
> +            host = g_strndup(vnc+1, hlen - 2);

Inconsistent spacing around operators (2 of the three '-'/'+' are
missing spacing).

With that fixed,
Reviewed-by: Eric Blake <address@hidden>

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]