aboutsummaryrefslogtreecommitdiff
path: root/sunrpc
diff options
context:
space:
mode:
Diffstat (limited to 'sunrpc')
-rw-r--r--sunrpc/clnt_tcp.c2
-rw-r--r--sunrpc/clnt_udp.c4
-rw-r--r--sunrpc/rpc/xdr.h4
-rw-r--r--sunrpc/rpc_cmsg.c12
-rw-r--r--sunrpc/svc.c4
-rw-r--r--sunrpc/svc_udp.c2
-rw-r--r--sunrpc/xdr.c6
-rw-r--r--sunrpc/xdr_mem.c16
-rw-r--r--sunrpc/xdr_stdio.c13
9 files changed, 30 insertions, 33 deletions
diff --git a/sunrpc/clnt_tcp.c b/sunrpc/clnt_tcp.c
index 2222bc6577..f6b28b31d7 100644
--- a/sunrpc/clnt_tcp.c
+++ b/sunrpc/clnt_tcp.c
@@ -233,7 +233,7 @@ clnttcp_call(h, proc, xdr_args, args_ptr, xdr_results, results_ptr, timeout)
register XDR *xdrs = &(ct->ct_xdrs);
struct rpc_msg reply_msg;
u_long x_id;
- u_long *msg_x_id = (u_long *)(ct->ct_mcall); /* yuk */
+ u_int32_t *msg_x_id = (u_int32_t *)(ct->ct_mcall); /* yuk */
register bool_t shipnow;
int refreshes = 2;
diff --git a/sunrpc/clnt_udp.c b/sunrpc/clnt_udp.c
index 815cbb4ed2..706457a606 100644
--- a/sunrpc/clnt_udp.c
+++ b/sunrpc/clnt_udp.c
@@ -324,10 +324,10 @@ send_again:
cu->cu_error.re_errno = errno;
return (cu->cu_error.re_status = RPC_CANTRECV);
}
- if (inlen < sizeof(u_long))
+ if (inlen < 4)
continue;
/* see if reply transaction id matches sent id */
- if (*((u_long *)(cu->cu_inbuf)) != *((u_long *)(cu->cu_outbuf)))
+ if (*((u_int32_t *)(cu->cu_inbuf)) != *((u_int32_t *)(cu->cu_outbuf)))
continue;
/* we now assume we have the proper reply */
break;
diff --git a/sunrpc/rpc/xdr.h b/sunrpc/rpc/xdr.h
index 6cd3e6fe03..0d9b5df7a2 100644
--- a/sunrpc/rpc/xdr.h
+++ b/sunrpc/rpc/xdr.h
@@ -203,8 +203,8 @@ struct xdr_discrim {
* N.B. and frozen for all time: each data type here uses 4 bytes
* of external representation.
*/
-#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*(buf)++))
-#define IXDR_PUT_LONG(buf, v) (*(buf)++ = (long)htonl((u_long)v))
+#define IXDR_GET_LONG(buf) ((long)ntohl((u_long)*((u_int32_t*)buf)++))
+#define IXDR_PUT_LONG(buf, v) (*((u_int32_t*)(buf))++ = (long)htonl((u_long)v))
#define IXDR_GET_BOOL(buf) ((bool_t)IXDR_GET_LONG(buf))
#define IXDR_GET_ENUM(buf, t) ((t)IXDR_GET_LONG(buf))
diff --git a/sunrpc/rpc_cmsg.c b/sunrpc/rpc_cmsg.c
index d9d815a6fb..a4d5ef3e49 100644
--- a/sunrpc/rpc_cmsg.c
+++ b/sunrpc/rpc_cmsg.c
@@ -82,7 +82,7 @@ xdr_callmsg(xdrs, cmsg)
IXDR_PUT_LONG(buf, oa->oa_length);
if (oa->oa_length) {
bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
- buf += RNDUP(oa->oa_length) / sizeof (long);
+ buf = (long *) ((char *) buf + RNDUP(oa->oa_length));
}
oa = &cmsg->rm_call.cb_verf;
IXDR_PUT_ENUM(buf, oa->oa_flavor);
@@ -90,7 +90,7 @@ xdr_callmsg(xdrs, cmsg)
if (oa->oa_length) {
bcopy(oa->oa_base, (caddr_t)buf, oa->oa_length);
/* no real need....
- buf += RNDUP(oa->oa_length) / sizeof (long);
+ buf = (long *) ((char *) buf + RNDUP(oa->oa_length));
*/
}
return (TRUE);
@@ -132,8 +132,8 @@ xdr_callmsg(xdrs, cmsg)
bcopy((caddr_t)buf, oa->oa_base,
oa->oa_length);
/* no real need....
- buf += RNDUP(oa->oa_length) /
- sizeof (long);
+ buf = (long *) ((char *) buf
+ + RNDUP(oa->oa_length));
*/
}
}
@@ -166,8 +166,8 @@ xdr_callmsg(xdrs, cmsg)
bcopy((caddr_t)buf, oa->oa_base,
oa->oa_length);
/* no real need...
- buf += RNDUP(oa->oa_length) /
- sizeof (long);
+ buf = (long *) ((char *) buf
+ + RNDUP(oa->oa_length));
*/
}
}
diff --git a/sunrpc/svc.c b/sunrpc/svc.c
index 3327ee5bdd..7bfe680718 100644
--- a/sunrpc/svc.c
+++ b/sunrpc/svc.c
@@ -400,7 +400,7 @@ svc_getreqset(readfds)
register SVCXPRT *xprt;
register u_long mask;
register int bit;
- register u_long *maskp;
+ register u_int32_t *maskp;
register int setsize;
register int sock;
char cred_area[2*MAX_AUTH_BYTES + RQCRED_SIZE];
@@ -411,7 +411,7 @@ svc_getreqset(readfds)
#ifdef FD_SETSIZE
setsize = _rpc_dtablesize();
- maskp = (u_long *)readfds->fds_bits;
+ maskp = (u_int32_t *)readfds->fds_bits;
for (sock = 0; sock < setsize; sock += NFDBITS) {
for (mask = *maskp++; bit = ffs(mask); mask ^= (1 << (bit - 1))) {
/* sock has input waiting */
diff --git a/sunrpc/svc_udp.c b/sunrpc/svc_udp.c
index 079502c508..a910452094 100644
--- a/sunrpc/svc_udp.c
+++ b/sunrpc/svc_udp.c
@@ -181,7 +181,7 @@ svcudp_recv(xprt, msg)
0, (struct sockaddr *)&(xprt->xp_raddr), &(xprt->xp_addrlen));
if (rlen == -1 && errno == EINTR)
goto again;
- if (rlen < 4*sizeof(u_long))
+ if (rlen < 16) /* < 4 32-bit ints? */
return (FALSE);
xdrs->x_op = XDR_DECODE;
XDR_SETPOS(xdrs, 0);
diff --git a/sunrpc/xdr.c b/sunrpc/xdr.c
index b8248c20b5..a79db85b86 100644
--- a/sunrpc/xdr.c
+++ b/sunrpc/xdr.c
@@ -99,7 +99,7 @@ xdr_int(xdrs, ip)
(void) (xdr_short(xdrs, (short *)ip));
return (xdr_long(xdrs, (long *)ip));
#else
- if (sizeof (int) == sizeof (long)) {
+ if (sizeof (int) == 4) {
return (xdr_long(xdrs, (long *)ip));
} else {
return (xdr_short(xdrs, (short *)ip));
@@ -120,7 +120,7 @@ xdr_u_int(xdrs, up)
(void) (xdr_short(xdrs, (short *)up));
return (xdr_u_long(xdrs, (u_long *)up));
#else
- if (sizeof (u_int) == sizeof (u_long)) {
+ if (sizeof (u_int) == 4) {
return (xdr_u_long(xdrs, (u_long *)up));
} else {
return (xdr_short(xdrs, (short *)up));
@@ -307,7 +307,7 @@ xdr_enum(xdrs, ep)
/*
* enums are treated as ints
*/
- if (sizeof (enum sizecheck) == sizeof (long)) {
+ if (sizeof (enum sizecheck) == 4) {
return (xdr_long(xdrs, (long *)ep));
} else if (sizeof (enum sizecheck) == sizeof (short)) {
return (xdr_short(xdrs, (short *)ep));
diff --git a/sunrpc/xdr_mem.c b/sunrpc/xdr_mem.c
index 558d369227..fb15f113ce 100644
--- a/sunrpc/xdr_mem.c
+++ b/sunrpc/xdr_mem.c
@@ -97,10 +97,10 @@ xdrmem_getlong(xdrs, lp)
long *lp;
{
- if ((xdrs->x_handy -= sizeof(long)) < 0)
+ if ((xdrs->x_handy -= 4) < 0)
return (FALSE);
- *lp = (long)ntohl((u_long)(*((long *)(xdrs->x_private))));
- xdrs->x_private += sizeof(long);
+ *lp = (long)ntohl((u_long)(*((int32_t *)(xdrs->x_private))));
+ xdrs->x_private += 4;
return (TRUE);
}
@@ -110,10 +110,10 @@ xdrmem_putlong(xdrs, lp)
long *lp;
{
- if ((xdrs->x_handy -= sizeof(long)) < 0)
+ if ((xdrs->x_handy -= 4) < 0)
return (FALSE);
- *(long *)xdrs->x_private = (long)htonl((u_long)(*lp));
- xdrs->x_private += sizeof(long);
+ *(int32_t *)xdrs->x_private = (long)htonl((u_long)(*(int32_t*)lp));
+ xdrs->x_private += 4;
return (TRUE);
}
@@ -150,7 +150,7 @@ xdrmem_getpos(xdrs)
register XDR *xdrs;
{
- return ((u_int)xdrs->x_private - (u_int)xdrs->x_base);
+ return ((u_long)xdrs->x_private - (u_long)xdrs->x_base);
}
static bool_t
@@ -164,7 +164,7 @@ xdrmem_setpos(xdrs, pos)
if ((long)newaddr > (long)lastaddr)
return (FALSE);
xdrs->x_private = newaddr;
- xdrs->x_handy = (int)lastaddr - (int)newaddr;
+ xdrs->x_handy = (long)lastaddr - (long)newaddr;
return (TRUE);
}
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index 694774f6f6..da4877a9e8 100644
--- a/sunrpc/xdr_stdio.c
+++ b/sunrpc/xdr_stdio.c
@@ -104,12 +104,11 @@ xdrstdio_getlong(xdrs, lp)
XDR *xdrs;
register long *lp;
{
+ int32_t mycopy;
- if (fread((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+ if (fread((caddr_t)&mycopy, 4, 1, (FILE *)xdrs->x_private) != 1)
return (FALSE);
-#ifndef mc68000
- *lp = ntohl(*lp);
-#endif
+ *(int32_t*)lp = ntohl(mycopy);
return (TRUE);
}
@@ -119,11 +118,9 @@ xdrstdio_putlong(xdrs, lp)
long *lp;
{
-#ifndef mc68000
- long mycopy = htonl(*lp);
+ int32_t mycopy = htonl(*(int32_t*)lp);
lp = &mycopy;
-#endif
- if (fwrite((caddr_t)lp, sizeof(long), 1, (FILE *)xdrs->x_private) != 1)
+ if (fwrite((caddr_t)lp, 4, 1, (FILE *)xdrs->x_private) != 1)
return (FALSE);
return (TRUE);
}