From: stefano.stabellini@eu.citrix.com Subject: [PATCH] xl: fix vcpu-set cmd line parsing Date: Mon, 30 Aug 2010 17:40:11 +0100 Message-ID: <1283186411-17714-2-git-send-email-stefano.stabellini@eu.citrix.com> References: <1283186411-17714-1-git-send-email-stefano.stabellini@eu.citrix.com> Return-path: In-Reply-To: <1283186411-17714-1-git-send-email-stefano.stabellini@eu.citrix.com> 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@lists.xensource.com Cc: Stefano Stabellini List-Id: xen-devel@lists.xenproject.org Signed-off-by: Stefano Stabellini diff -r defdbfd1608c tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Mon Aug 30 17:34:53 2010 +0100 +++ b/tools/libxl/xl_cmdimpl.c Mon Aug 30 17:36:50 2010 +0100 @@ -3526,10 +3526,6 @@ int main_vcpuset(int argc, char **argv) { int opt; - if (argc != 4) { - help("vcpu-set"); - return 0; - } while ((opt = getopt(argc, argv, "h")) != -1) { switch (opt) { case 'h': @@ -3541,7 +3537,12 @@ int main_vcpuset(int argc, char **argv) } } - vcpuset(argv[2], argv[3]); + if (optind >= argc - 1) { + help("vcpu-set"); + return 2; + } + + vcpuset(argv[optind], argv[optind+1]); return 0; }