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

Re: [Xen-devel] [PATCH 2/2] tools: utility to dump guest grant table info



On Fri, Jun 30, 2017 at 03:21:31PM +0800, Dongli Zhang wrote:
> +
> +int main(int argc, char *argv[])
> +{
> +    xc_interface *xch;
> +    int domid, rc, c;
> +    struct gnttab_query_size query;
> +
> +    while ( (c = getopt(argc, argv, "h")) != -1 )
> +    {
> +        switch ( c )
> +        {
> +        case 'h':
> +            show_help();
> +            return 0;
> +        }
> +    }
> +
> +    domid = (argc > 1) ? strtol(argv[1], NULL, 10) : 0;

This is too simplistic. It basically means ./query -x 100 will not
report an error. You should use optind instead. See man 3 getopt for
examples.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.