Re: [PATCH] tests: command: Fix build on ppc64/aarch64

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

 



On Wed, 2016-07-13 at 19:20 +0200, Andrea Bolognani wrote:
> Commit ca10bb040fcf introduced a new test that fails to build
> on at least some architectures:
> 
>   commandtest.c: In function 'test25':
>   commandtest.c:1121:5: error: comparison is always true due to
>                         limited range of data type [-Werror=type-limits]
>     if (rv >= 0) {
>     ^
> 
> Change the type of 'rv' from char to int, which is the proper
> return type for virCommandExec() anyway.
> ---
> Posting this to the list so that Michal/others can chime in.
> 
> Using int instead of char seems completely safe here, and in
> fact should probably have been the right choice from the start.
> 
> On the other hand, I would expect this kind of error if we were
> using unsigned char, not plain char... By the way, changing it
> to signed char is another way to get the code to compile again
> on ppc64/aarch64.
> 
>  tests/commandtest.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tests/commandtest.c b/tests/commandtest.c
> index 2b77b9b..7bf5447 100644
> --- a/tests/commandtest.c
> +++ b/tests/commandtest.c
> @@ -1068,7 +1068,7 @@ static int test25(const void *unused ATTRIBUTE_UNUSED)
>  {
>      int ret = -1;
>      int pipeFD[2] = { -1, -1};
> -    char rv = 0;
> +    int rv = 0;
>      ssize_t tries = 100;
>      pid_t pid;

I meant to CC: Michal, but git-send-email thought

  --confirm=always--cc=mpri...

was my way of saying "go ahead" :)

-- 
Andrea Bolognani / Red Hat / Virtualization

--
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]