From a8f2e5659fe008d2c38e349ed5315e43fbd0e0d5 Mon Sep 17 00:00:00 2001 From: Roland McGrath Date: Mon, 18 Jul 2005 03:06:34 +0000 Subject: [PATCH] 2005-03-21 Thorsten Kukuk [BZ #1098] * sunrpc/xdr_stdio.c (xdrstdio_getlong, xdrstdio_putlong): Convert correctly between long/int on 64bit big-endian. --- sunrpc/xdr_stdio.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c index 4daa062c825..e73c5a52025 100644 --- a/sunrpc/xdr_stdio.c +++ b/sunrpc/xdr_stdio.c @@ -108,20 +108,20 @@ xdrstdio_destroy (XDR *xdrs) static bool_t xdrstdio_getlong (XDR *xdrs, long *lp) { - int32_t mycopy; + u_int32_t mycopy; - if (fread ((caddr_t) & mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) + if (fread ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; - *lp = (int32_t) ntohl (mycopy); + *lp = (long) ntohl (mycopy); return TRUE; } static bool_t xdrstdio_putlong (XDR *xdrs, const long *lp) { - long mycopy = htonl (*lp); - lp = &mycopy; - if (fwrite ((caddr_t) lp, 4, 1, (FILE *) xdrs->x_private) != 1) + int32_t mycopy = htonl ((u_int32_t) *lp); + + if (fwrite ((caddr_t) &mycopy, 4, 1, (FILE *) xdrs->x_private) != 1) return FALSE; return TRUE; } -- 2.47.2