]> xenbits.xensource.com Git - libvirt.git/commitdiff
* src/virsh.c: patch from Masayuki Sunou to fix parameter
authorDaniel Veillard <veillard@redhat.com>
Tue, 6 Nov 2007 09:41:18 +0000 (09:41 +0000)
committerDaniel Veillard <veillard@redhat.com>
Tue, 6 Nov 2007 09:41:18 +0000 (09:41 +0000)
  validation of virsh schedinfo parameters.
Daniel

ChangeLog
src/virsh.c

index 4d74a78da671183aeb403cf88519a969a789b5ec..f79981c1e37d6f789ba9fd64638fe72fa409a8d1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Nov  6 10:40:13 CET 2007 Daniel Veillard <veillard@redhat.com>
+
+       * src/virsh.c: patch from Masayuki Sunou to fix parameter
+         validation of virsh schedinfo parameters.
+
 Mon Nov  5 11:11:45 CET 2007 Daniel Veillard <veillard@redhat.com>
 
        * src/xml.c: patch from Beth Kon to fix a problem when the
index 5af821ce475b027d931ebcbdf5de1b41a13672b4..0615a7d44623e8db29d057c733aa1cbccbd26a80 100644 (file)
@@ -1149,11 +1149,25 @@ cmdSchedinfo(vshControl * ctl, vshCmd * cmd)
         return FALSE;
 
     /* Currently supports Xen Credit only */
-    weight = vshCommandOptInt(cmd, "weight", &weightfound);
-    if (weightfound) nr_inputparams++;
-            
-    cap    = vshCommandOptInt(cmd, "cap", &capfound);
-    if (capfound) nr_inputparams++;
+    if(vshCommandOptBool(cmd, "weight")) {
+        weight = vshCommandOptInt(cmd, "weight", &weightfound);
+        if (!weightfound) {
+            vshError(ctl, FALSE, _("Invalid value of weight"));
+            goto cleanup;
+        } else {
+            nr_inputparams++;
+        }
+    }
+
+    if(vshCommandOptBool(cmd, "cap")) {
+        cap = vshCommandOptInt(cmd, "cap", &capfound);
+        if (!capfound) {
+            vshError(ctl, FALSE, _("Invalid value of cap"));
+            goto cleanup;
+        } else {
+            nr_inputparams++;
+        }
+    }
 
     params = vshMalloc(ctl, sizeof (virSchedParameter) * nr_inputparams);
     if (params == NULL) {