1 --- hash_page.c.orig 2009-11-06 12:41:16.000000000 -0800
2 +++ hash_page.c 2009-11-06 12:43:23.000000000 -0800
3 @@ -70,7 +70,7 @@ __FBSDID("$FreeBSD: src/lib/libc/db/hash
8 +#include "hash_extern.h"
10 static u_int32_t *fetch_bitmap(HTAB *, int);
11 static u_int32_t first_free(u_int32_t);
12 @@ -571,7 +571,7 @@ __get_page(HTAB *hashp, char *p, u_int32
14 __put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
16 - int fd, page, size, wsize;
17 + int fd, page, size, wsize, max;
20 if ((hashp->fp == -1) && open_temp(hashp))
21 @@ -579,7 +579,7 @@ __put_page(HTAB *hashp, char *p, u_int32
24 if (hashp->LORDER != BYTE_ORDER) {
29 max = hashp->BSIZE >> 2; /* divide by 4 */
30 @@ -602,6 +602,18 @@ __put_page(HTAB *hashp, char *p, u_int32
34 + /* 4485533 - reswap the in-memory copy */
35 + if (hashp->LORDER != BYTE_ORDER) {
39 + for (i = 0; i < max; i++)
40 + M_32_SWAP(((int *)p)[i]);
42 + for (i = 0; i <= max; i++)
43 + M_16_SWAP(((u_int16_t *)p)[i]);