]> xenbits.xensource.com Git - libvirt.git/commitdiff
Fix compile warnings in virsh vcpupin
authorDaniel P. Berrange <berrange@redhat.com>
Mon, 20 Jun 2011 13:28:14 +0000 (14:28 +0100)
committerDaniel P. Berrange <berrange@redhat.com>
Mon, 20 Jun 2011 13:50:27 +0000 (14:50 +0100)
The 'char *cur' variable was being assigned from a
'const char *' string, thus discarding constness.
As well as causing a compile warning, it masked a
piece of code which attempts to assign to the
previously const string.

* tools/virsh.c: Fix const-ness of 'cur' variable in vcpupin

tools/virsh.c

index e04c9fcae6a7e24ed825e583cf0533272f546c74..abc46142fec61e89911f75748a53edeeedb11e5e 100644 (file)
@@ -3000,7 +3000,7 @@ cmdVcpupin(vshControl *ctl, const vshCmd *cmd)
     int cpumaplen;
     int i, cpu, lastcpu, maxcpu;
     bool unuse = false;
-    char *cur;
+    const char *cur;
     int config = vshCommandOptBool(cmd, "config");
     int live = vshCommandOptBool(cmd, "live");
     int current = vshCommandOptBool(cmd, "current");
@@ -3067,7 +3067,7 @@ cmdVcpupin(vshControl *ctl, const vshCmd *cmd)
     } else if (*cur == 'r') {
         for (cpu = 0; cpu < maxcpu; cpu++)
             VIR_USE_CPU(cpumap, cpu);
-        *cur = 0;
+        cur = "";
     }
 
     while (*cur != 0) {