From: Jeremy Fitzhardinge Subject: [PATCH 2/3] xl: fix network-list command line parsing Date: Wed, 02 Jun 2010 16:09:52 -0700 Message-ID: <4C06E4C0.6050501@goop.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Xen-devel Cc: Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Command line arguments start at argv[2]. Signed-off-by: Jeremy Fitzhardinge diff -r 6b7c6cad5c5a tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Wed Jun 02 11:29:02 2010 -0700 +++ b/tools/libxl/xl_cmdimpl.c Wed Jun 02 11:31:35 2010 -0700 @@ -3389,11 +3389,11 @@ libxl_nicinfo *nics; unsigned int nb; - if (argc < 2) { + if (argc < 3) { help("network-list"); exit(1); } - while ((opt = getopt(argc, argv, "hl")) != -1) { + while ((opt = getopt(argc, argv, "h")) != -1) { switch (opt) { case 'h': help("network-list"); @@ -3407,7 +3407,7 @@ /* Idx BE MAC Hdl Sta evch txr/rxr BE-path */ printf("%-3s %-2s %-17s %-6s %-5s %-6s %5s/%-5s %-30s\n", "Idx", "BE", "Mac Addr.", "handle", "state", "evt-ch", "tx-", "rx-ring-ref", "BE-path"); - for (++argv, --argc; argc > 0; --argc, ++argv) { + for (argv += 2, argc -= 2; argc > 0; --argc, ++argv) { if (domain_qualifier_to_domid(*argv, &domid, 0) < 0) { fprintf(stderr, "%s is an invalid domain identifier\n", *argv); continue;