[sheepdog] [PATCH] corosync: fix a compiler warning

Hitoshi Mitake mitake.hitoshi at lab.ntt.co.jp
Tue Nov 11 09:05:09 CET 2014


At Tue, 14 Oct 2014 16:13:38 +0800,
Liu Yuan wrote:
> 
> Fix following warning:
> 
> ...
> cluster/corosync.c: In function ‘corosync_get_local_addr’:
> cluster/corosync.c:132:22: warning: declaration of ‘sin’ shadows a global declaration [-Wshadow]
>   CCLD   sheep
> make[1]: Leaving directory `/home/test/sheepdog/sheep'
> ...
> 
> Signed-off-by: Liu Yuan <namei.unix at gmail.com>
> ---
>  sheep/cluster/corosync.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)

Applied, thanks.
Hitoshi

> 
> diff --git a/sheep/cluster/corosync.c b/sheep/cluster/corosync.c
> index f876112..b7fc025 100644
> --- a/sheep/cluster/corosync.c
> +++ b/sheep/cluster/corosync.c
> @@ -129,7 +129,7 @@ static int corosync_get_local_addr(uint8_t *addr)
>  	int ret, nr;
>  	corosync_cfg_node_address_t caddr;
>  	struct sockaddr_storage *ss = (struct sockaddr_storage *)caddr.address;
> -	struct sockaddr_in *sin = (struct sockaddr_in *)caddr.address;
> +	struct sockaddr_in *sin4 = (struct sockaddr_in *)caddr.address;
>  	struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)caddr.address;
>  	void *saddr;
>  
> @@ -149,7 +149,7 @@ static int corosync_get_local_addr(uint8_t *addr)
>  		saddr = &sin6->sin6_addr;
>  		memcpy(addr, saddr, 16);
>  	} else if (ss->ss_family == AF_INET) {
> -		saddr = &sin->sin_addr;
> +		saddr = &sin4->sin_addr;
>  		memset(addr, 0, 16);
>  		memcpy(addr + 12, saddr, 4);
>  	} else {
> -- 
> 1.9.1
> 
> -- 
> sheepdog mailing list
> sheepdog at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog



More information about the sheepdog mailing list