qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH for-2.9 3/5] rbd: Rewrite the code to extract li


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH for-2.9 3/5] rbd: Rewrite the code to extract list-valued options
Date: Thu, 23 Mar 2017 15:51:25 -0500
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0

On 03/23/2017 02:18 PM, Eric Blake wrote:

>>>> -            if (port) {
>>>> -                /* check for ipv6 */
>>>> -                if (strchr(host, ':')) {
>>>> -                    strbuf = g_strdup_printf("[%s]:%s", host, port);
>>>> -                } else {
>>>> -                    strbuf = g_strdup_printf("%s:%s", host, port);
>>>
>>> The old code only prints port information if it is present...
>>>

>>> ...but the new code unconditionally prints port information, even when
>>> port == NULL.  Oops.
>>
>> How can port be null?  SocketAddress member port is mandatory...
> 
> Indeed. Does that mean the old code had a dead branch? Looks like it!

Or else my reading of the old code was wrong.  It looks like port was
optional on the command line, but in the conversion to QemuOpts, a
missing port was treated as the default port.  Now that you are not
going through QemuOpts, you have to make sure that you can still supply
a default port to keep the QAPI happy with a mandatory port.

-- 
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]