From mboxrd@z Thu Jan 1 00:00:00 1970 From: Juergen Gross Subject: [Patch] xl: correct vcpu-pin and vcpu-list parameter checking Date: Wed, 08 Sep 2010 09:35:19 +0200 Message-ID: <4C873CB7.8020202@ts.fujitsu.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------020202060809060506000800" 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@lists.xensource.com" List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------020202060809060506000800 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, attached patch corrects parameter checking of vcpu-pin and vcpu-list sub-commands. Juergen -- Juergen Gross Principal Developer Operating Systems TSP ES&S SWE OS6 Telephone: +49 (0) 89 3222 2967 Fujitsu Technology Solutions e-mail: juergen.gross@ts.fujitsu.com Domagkstr. 28 Internet: ts.fujitsu.com D-80807 Muenchen Company details: ts.fujitsu.com/imprint.html --------------020202060809060506000800 Content-Type: text/x-patch; name="xl_argc.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="xl_argc.patch" diff -r 1831912d4109 tools/libxl/xl_cmdimpl.c --- a/tools/libxl/xl_cmdimpl.c Thu Sep 02 19:12:42 2010 +0100 +++ b/tools/libxl/xl_cmdimpl.c Wed Sep 08 09:31:01 2010 +0200 @@ -3405,7 +3405,7 @@ int main_vcpulist(int argc, char **argv) } } - vcpulist(argc - 2, argv + 2); + vcpulist(argc - optind, argv + optind); return 0; } @@ -3494,22 +3494,23 @@ int main_vcpupin(int argc, char **argv) { int opt; - if (argc != 5) { + while ((opt = getopt(argc, argv, "h")) != -1) { + switch (opt) { + case 'h': + help("vcpu-pin"); + return 0; + default: + fprintf(stderr, "option `%c' not supported.\n", opt); + break; + } + } + + if (optind != argc - 3) { help("vcpu-pin"); - return 0; - } - while ((opt = getopt(argc, argv, "h")) != -1) { - switch (opt) { - case 'h': - help("vcpu-pin"); - return 0; - default: - fprintf(stderr, "option `%c' not supported.\n", opt); - break; - } - } - - vcpupin(argv[2], argv[3] , argv[4]); + return 2; + } + + vcpupin(argv[optind], argv[optind+1] , argv[optind+2]); return 0; } --------------020202060809060506000800 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel --------------020202060809060506000800--