Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F144635723
D52201.1775929224.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D52201.1775929224.diff
View Options
diff --git a/lib/libc/db/hash/hash_page.c b/lib/libc/db/hash/hash_page.c
--- a/lib/libc/db/hash/hash_page.c
+++ b/lib/libc/db/hash/hash_page.c
@@ -568,7 +568,7 @@
int
__put_page(HTAB *hashp, char *p, u_int32_t bucket, int is_bucket, int is_bitmap)
{
- int fd, page, size;
+ int error, fd, page, size;
ssize_t wsize;
char pbuf[MAX_BSIZE];
@@ -577,6 +577,7 @@
return (-1);
fd = hashp->fp;
+ error = 0;
if (hashp->LORDER != BYTE_ORDER) {
int i, max;
@@ -597,14 +598,24 @@
page = BUCKET_TO_PAGE(bucket);
else
page = OADDR_TO_PAGE(bucket);
- if ((wsize = pwrite(fd, p, size, (off_t)page << hashp->BSHIFT)) == -1)
- /* Errno is set */
- return (-1);
+ wsize = pwrite(fd, p, size, (off_t)page << hashp->BSHIFT);
if (wsize != size) {
- errno = EFTYPE;
- return (-1);
+ error = -1;
+ if (wsize != -1)
+ errno = EFTYPE;
}
- return (0);
+ if (hashp->LORDER != BYTE_ORDER) {
+ int i;
+
+ if (is_bitmap) {
+ for (i = 0; i < max; i++)
+ M_32_SWAP(((int *)p)[i]);
+ } else {
+ for (i = 0; i <= max; i++)
+ M_16_SWAP(((u_int16_t *)p)[i]);
+ }
+ }
+ return (error);
}
#define BYTE_MASK ((1 << INT_BYTE_SHIFT) -1)
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, Apr 11, 5:40 PM (7 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
28325787
Default Alt Text
D52201.1775929224.diff (1 KB)
Attached To
Mode
D52201: db/hash_page.c: Reswap memory buffer in __put_page when dealing with a different byte order
Attached
Detach File
Event Timeline
Log In to Comment