[sheepdog] [PATCH] collie: correct command-line options parser
Liu Yuan
namei.unix at gmail.com
Mon Mar 18 06:12:35 CET 2013
On 03/18/2013 01:08 PM, Liu Yuan wrote:
> On 03/18/2013 08:43 AM, MORITA Kazutaka wrote:
>>>>>> + if (flags & SUBCMD_FLAG_NEED_THIRD_ARG && optind <= 3)
>>>>>> subcommand_usage(argv[1], argv[2], EXIT_USAGE);
>>>>>>
>>>>>> return command_fn(argc, argv);
>>>>>>
>>>>
>>>> Kazutaka, this bug does exist (even with '-p 7001'), but 'optind <= 3'
>>>> looks quite suspicious to me, could you review it?
>> It is not a good idea to increase optind before getopt_long. The real
>> problem is that we specify the thrid arguemnt as argv[3] in
>> cluster_recover. It should be argv[optind].
>
> ChenZhe, could you prepare a new patch v2 based on this comment?
>
Hi ChenZhe,
There are other places use the wrong argv[3] too, such as
vdi_cache() and debug_trace(). You'd better correct them too in V2.
Thanks,
Yuan
More information about the sheepdog
mailing list