WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH] xl: fix vcpu-set cmd line parsing

On Tue, 31 Aug 2010, Ian Jackson wrote:
> stefano.stabellini@xxxxxxxxxxxxx writes ("[Xen-devel] [PATCH] xl: fix 
> vcpu-set cmd line parsing"):
> > -    if (argc != 4) {
> > -        help("vcpu-set");
> ...
> > +    if (optind >= argc - 1) {
> > +        help("vcpu-set");
> 
> I applaud your efforts to fix up the broken command-line parsing but
> surely this can't be right ?  We need to have exactly two more
> arguments, not at least two.
 
Yes, you are right.
Updated patch appended.

---

xl: fix vcpu-set cmd line parsing

Signed-off-by: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>

diff -r ae0cd4e5cc01 tools/libxl/xl_cmdimpl.c
--- a/tools/libxl/xl_cmdimpl.c  Wed Sep 01 10:19:14 2010 +0100
+++ b/tools/libxl/xl_cmdimpl.c  Wed Sep 01 11:24:03 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 - 2) {
+        help("vcpu-set");
+        return 2;
+    }
+
+    vcpuset(argv[optind], argv[optind+1]);
     return 0;
 }
 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

<Prev in Thread] Current Thread [Next in Thread>
  • Re: [Xen-devel] [PATCH] xl: fix vcpu-set cmd line parsing, Stefano Stabellini <=