On 02/11/2017 01:30 PM, Eric Blake wrote:
>>>>> On 02/03/2017 09:47 AM, Vladimir Sementsov-Ogievskiy wrote:
>>>>>> Split out nbd_receive_simple_option to be reused for structured reply
>>>>>> option.
>>>>>> +    return "<unknown option>";
>>>>> Can you please consider making this include the %d representation of
>>>>> the
>>>>> unknown option; perhaps by snprintf'ing into static storage?  While it

> If you're still worried about the race (I'm not), to the point that you
> don't want to use static storage just to avoid g_malloc(), then another
> option is to make nbd_opt_name() take an input parameter for a buffer
> and max size, and let the caller provide stack-based storage for
> computing the resulting message (similar to how strerror_r does things).

Or, as long as the caller prints the value as well as the reverse-mapped
name, that would work too.  I'm going to add such a reverse-mapping for
my NBD_INFO_* patches about to land later today, so I'll make my
counter-proposal for NBD_OPT_* along those lines as part of my series.

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