Re: [PATCH] Fix compile warnings in virsh vcpupin

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



2011/6/20 Daniel P. Berrange <berrange@xxxxxxxxxx>:
> 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 |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/tools/virsh.c b/tools/virsh.c
> index 3df0683..ed26b93 100644
> --- a/tools/virsh.c
> +++ b/tools/virsh.c
> @@ -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) {
> --
> 1.7.4.4
>

I posted a fix for this already

https://www.redhat.com/archives/libvir-list/2011-June/msg00872.html

but yours is smaller, as I changed the control flow in mine.

ACK.

-- 
Matthias Bolte
http://photron.blogspot.com

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list



[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]