On 06/29/2016 02:22 AM, Denis V. Lunev wrote:
> On 06/29/2016 12:27 AM, Stefan Hajnoczi wrote:
>> From: "Denis V. Lunev" <d...@openvz.org>
>>
>> This is necessary to enable creation of common qemu-img options which
>> will
>> be specified before command.

>> +    cmdname = argv[optind];
>> +
>> +    /* reset getopt_long scanning */
>> +    argc -= optind;
>> +    if (argc < 1) {
>> +        return 0;
>> +    }
>> +    argv += optind;
>> +    optind = 1;
> this patch breaks check-block.sh
> we should have here
>   'optind = 0'

Uggh. You've landed in one of the portability traps of getopt().  On
glibc, you can reset option parsing by assigning optind to 1 (but it
also works by assigning it to 0); on BSD, you instead set the variable
'optreset'; on Solaris, there is no way to reset option parsing (but
then again, Solaris doesn't maintain any invisible state like glibc or
BSD where you need to go out of your way to do a full reset).

But regardless of how you look at it, the patch has now been committed
to master without your suggested fix, so you'll have to propose a formal
followup patch as a new thread.

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