Re: [PATCH] xen: fix build error on rhel-5

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

 



On 04/14/2015 06:43 AM, Pavel Hrdina wrote:
> ../../src/xen/block_stats.c:82: warning: dereferencing type-punned
>     pointer will break strict-aliasing rules [-Wstrict-aliasing]
> 
> Signed-off-by: Pavel Hrdina <phrdina@xxxxxxxxxx>
> ---
>  src/xen/block_stats.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/src/xen/block_stats.c b/src/xen/block_stats.c
> index e1e10a2..9dd3a07 100644
> --- a/src/xen/block_stats.c
> +++ b/src/xen/block_stats.c
> @@ -63,7 +63,7 @@ static int64_t
>  read_stat(const char *path)
>  {
>      char str[64];
> -    int64_t r;
> +    long long r;
>      size_t i;
>      FILE *fp;
>  
> @@ -79,10 +79,10 @@ read_stat(const char *path)
>          return -1;
>  
>      str[i] = '\0';              /* make sure the string is nul-terminated */
> -    if (virStrToLong_ll(str, NULL, 10, (long long *) &r) < 0)
> +    if (virStrToLong_ll(str, NULL, 10, &r) < 0)
>          return -1;
>  
> -    return r;
> +    return (int64_t)r;

The cast is not necessary here.

ACK whether or not you drop the cast.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

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