about summary refs log tree commit diff
path: root/sunrpc/xdr_stdio.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2005-03-22 09:14:36 +0000
committerUlrich Drepper <drepper@redhat.com>2005-03-22 09:14:36 +0000
commit12c879f8bf002fdeeb0f598fe1909e495dbb7901 (patch)
treecf369fad02a7a7c8e3fe8e911f281bce20759609 /sunrpc/xdr_stdio.c
parent0ab1b506f793396da1840fa3ce3f236d42bff1b6 (diff)
downloadglibc-12c879f8bf002fdeeb0f598fe1909e495dbb7901.tar.gz
glibc-12c879f8bf002fdeeb0f598fe1909e495dbb7901.tar.xz
glibc-12c879f8bf002fdeeb0f598fe1909e495dbb7901.zip
* sunrpc/xdr_stdio.c (xdrstdio_getlong, xdrstdio_putlong):
	Convert correctly between long/int on 64bit big-endian.
Diffstat (limited to 'sunrpc/xdr_stdio.c')
-rw-r--r--sunrpc/xdr_stdio.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c
index 4daa062c82..e73c5a5202 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;
 }