From: Steve Dickson Date: Tue, 12 Feb 2013 19:26:31 +0000 (-0500) Subject: clnt_vc_control: Removed a strict-aliasing warning X-Git-Tag: libtirpc-0-2-3~2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fac3eb51;p=libtirpc clnt_vc_control: Removed a strict-aliasing warning clnt_vc.c:587:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] clnt_vc.c:593:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] clnt_vc.c:605:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] clnt_vc.c:611:7: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] Signed-off-by: Steve Dickson --- diff --git a/src/clnt_vc.c b/src/clnt_vc.c index 097cae8..7769809 100644 --- a/src/clnt_vc.c +++ b/src/clnt_vc.c @@ -504,6 +504,8 @@ clnt_vc_control(cl, request, info) sigset_t mask; sigset_t newmask; int rpc_lock_value; + u_int32_t tmp; + u_long ltmp; assert(cl != NULL); @@ -583,15 +585,15 @@ clnt_vc_control(cl, request, info) * begining of the RPC header. MUST be changed if the * call_struct is changed */ - *(u_int32_t *)info = - ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 4 * BYTES_PER_XDR_UNIT)); + memcpy(&tmp, ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, sizeof (tmp)); + ltmp = ntohl(tmp); + memcpy(info, <mp, sizeof (ltmp)); break; case CLSET_VERS: - *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 4 * BYTES_PER_XDR_UNIT) = - htonl(*(u_int32_t *)info); + memcpy(<mp, info, sizeof (ltmp)); + tmp = htonl(ltmp); + memcpy(ct->ct_u.ct_mcallc + 4 * BYTES_PER_XDR_UNIT, &tmp, sizeof(tmp)); break; case CLGET_PROG: @@ -601,15 +603,15 @@ clnt_vc_control(cl, request, info) * begining of the RPC header. MUST be changed if the * call_struct is changed */ - *(u_int32_t *)info = - ntohl(*(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 3 * BYTES_PER_XDR_UNIT)); + memcpy(&tmp, ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, sizeof (tmp)); + ltmp = ntohl (tmp); + memcpy(info, <mp, sizeof (ltmp)); break; case CLSET_PROG: - *(u_int32_t *)(void *)(ct->ct_u.ct_mcallc + - 3 * BYTES_PER_XDR_UNIT) = - htonl(*(u_int32_t *)info); + memcpy(<mp, info, sizeof (ltmp)); + tmp = htonl(ltmp); + memcpy(ct->ct_u.ct_mcallc + 3 * BYTES_PER_XDR_UNIT, &tmp, sizeof(tmp)); break; default: