summaryrefslogtreecommitdiff
path: root/usr/src/boot/lib/libstand
diff options
context:
space:
mode:
authorToomas Soome <tsoome@me.com>2019-05-30 09:18:03 +0300
committerToomas Soome <tsoome@me.com>2019-06-04 15:52:06 +0300
commit13a6e30d92032118a54c980158e488cf0aed1abf (patch)
tree0ca7564f64814b832d1c21a43498a4821b3ed2d3 /usr/src/boot/lib/libstand
parent6512942d214590d054e346dac0ae8ce162c1359d (diff)
downloadillumos-joyent-13a6e30d92032118a54c980158e488cf0aed1abf.tar.gz
11082 loader: Unexpand be32dec()
Reviewed by: Gergő Doma <domag02@gmail.com> Reviewed by: Rob Johnston <rob.johnston@joyent.com> Approved by: Dan McDonald <danmcd@joyent.com>
Diffstat (limited to 'usr/src/boot/lib/libstand')
-rw-r--r--usr/src/boot/lib/libstand/zfs/zfsimpl.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/usr/src/boot/lib/libstand/zfs/zfsimpl.c b/usr/src/boot/lib/libstand/zfs/zfsimpl.c
index 9217d4363a..328994ae86 100644
--- a/usr/src/boot/lib/libstand/zfs/zfsimpl.c
+++ b/usr/src/boot/lib/libstand/zfs/zfsimpl.c
@@ -30,6 +30,7 @@
* Stand-alone ZFS file reader.
*/
+#include <sys/endian.h>
#include <sys/stat.h>
#include <sys/stdint.h>
@@ -127,10 +128,7 @@ zfs_free(void *ptr, size_t size)
static int
xdr_int(const unsigned char **xdr, int *ip)
{
- *ip = ((*xdr)[0] << 24)
- | ((*xdr)[1] << 16)
- | ((*xdr)[2] << 8)
- | ((*xdr)[3] << 0);
+ *ip = be32dec(*xdr);
(*xdr) += 4;
return (0);
}
@@ -138,10 +136,7 @@ xdr_int(const unsigned char **xdr, int *ip)
static int
xdr_u_int(const unsigned char **xdr, u_int *ip)
{
- *ip = ((*xdr)[0] << 24)
- | ((*xdr)[1] << 16)
- | ((*xdr)[2] << 8)
- | ((*xdr)[3] << 0);
+ *ip = be32dec(*xdr);
(*xdr) += 4;
return (0);
}