diff options
author | Ulrich Drepper <drepper@redhat.com> | 2005-03-22 09:14:36 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2005-03-22 09:14:36 +0000 |
commit | 12c879f8bf002fdeeb0f598fe1909e495dbb7901 (patch) | |
tree | cf369fad02a7a7c8e3fe8e911f281bce20759609 /sunrpc | |
parent | 0ab1b506f793396da1840fa3ce3f236d42bff1b6 (diff) | |
download | glibc-12c879f8bf002fdeeb0f598fe1909e495dbb7901.zip glibc-12c879f8bf002fdeeb0f598fe1909e495dbb7901.tar.gz glibc-12c879f8bf002fdeeb0f598fe1909e495dbb7901.tar.bz2 |
* sunrpc/xdr_stdio.c (xdrstdio_getlong, xdrstdio_putlong):
Convert correctly between long/int on 64bit big-endian.
Diffstat (limited to 'sunrpc')
-rw-r--r-- | sunrpc/xdr_stdio.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/sunrpc/xdr_stdio.c b/sunrpc/xdr_stdio.c index 4daa062..e73c5a5 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; } |