[sheepdog] [PATCH] collie: correct command-line options parser

Liu Yuan namei.unix at gmail.com
Mon Mar 18 06:08:25 CET 2013


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?

Thanks,
Yuan



More information about the sheepdog mailing list