as well as some other warnings.
Signed-off-by: Steve Dickson <steved@redhat.com>
salen = sizeof(myaddr);
sa = (struct sockaddr *)&myaddr;
- if (getsockname(sd, sa, &salen) == -1)
+ if (getsockname(sd, (struct sockaddr *)&myaddr, &salen) == -1)
return -1; /* errno is correctly set */
- af = sa->sa_family;
- memset(sa, 0, salen);
+ af = myaddr.ss_family;
} else
af = sa->sa_family;
struct netbuf *np;
#ifdef PORTMAP
struct netbuf taddr;
- struct sockaddr_in *sin;
+ struct sockaddr_in sin;
if (pmap_flag && pmap_reply_flag) {
- sin = (struct sockaddr_in *)
- (void *)&fdlist[i].raddr;
- sin->sin_port =
- htons((u_short)port);
+ memcpy(&sin, &fdlist[i].raddr, sizeof(sin));
+ sin.sin_port = htons((u_short)port);
+ memcpy(&fdlist[i].raddr, &sin, sizeof(sin));
taddr.len = taddr.maxlen =
sizeof(fdlist[i].raddr);
taddr.buf = &fdlist[i].raddr;
socklen_t inlen, salen;
ssize_t recvlen = 0;
int rpc_lock_value;
- u_int32_t xid;
+ u_int32_t xid, inval, outval;
outlen = 0;
sigfillset(&newmask);
cu->cu_error.re_status = RPC_CANTRECV;
goto out;
}
- if (recvlen >= sizeof(u_int32_t) &&
- (cu->cu_async == TRUE ||
- *((u_int32_t *)(void *)(cu->cu_inbuf)) ==
- *((u_int32_t *)(void *)(cu->cu_outbuf))))
- inlen = (socklen_t)recvlen;
- else {
- total_time -= tv;
- goto send_again;
- }
+
+ if (recvlen < sizeof(u_int32_t)) {
+ total_time -= tv;
+ goto send_again;
+ }
+
+ if (cu->cu_async == TRUE)
+ inlen = (socklen_t)recvlen;
+ else {
+ memcpy(&inval, cu->cu_inbuf, sizeof(u_int32_t));
+ memcpy(&outval, cu->cu_outbuf, sizeof(u_int32_t));
+ if (inval != outval) {
+ total_time -= tv;
+ goto send_again;
+ }
+ inlen = (socklen_t)recvlen;
+ }
/*
* now decode and validate the response
return (rce_addr);
}
-void __attribute ((descructor)) tsd_key_delete(void)
+void tsd_key_delete(void)
{
if (clnt_broadcast_key != -1)
thr_keydelete(clnt_broadcast_key);
__rpc_sockisbound(int fd)
{
struct sockaddr_storage ss;
+ union {
+ struct sockaddr_in sin;
+ struct sockaddr_in6 sin6;
+ struct sockaddr_un usin;
+ } u_addr;
socklen_t slen;
slen = sizeof (struct sockaddr_storage);
switch (ss.ss_family) {
case AF_INET:
- return (((struct sockaddr_in *)
- (void *)&ss)->sin_port != 0);
+ memcpy(&u_addr.sin, &ss, sizeof(u_addr.sin));
+ return (u_addr.sin.sin_port != 0);
#ifdef INET6
case AF_INET6:
- return (((struct sockaddr_in6 *)
- (void *)&ss)->sin6_port != 0);
+ memcpy(&u_addr.sin6, &ss, sizeof(u_addr.sin6));
+ return (u_addr.sin6.sin6_port != 0);
#endif
case AF_LOCAL:
/* XXX check this */
- return (((struct sockaddr_un *)
- (void *)&ss)->sun_path[0] != '\0');
+ memcpy(&u_addr.usin, &ss, sizeof(u_addr.usin));
+ return (u_addr.usin.sun_path[0] != 0);
default:
break;
}