aboutsummaryrefslogtreecommitdiff
path: root/src/wal.c
diff options
context:
space:
mode:
authordrh <>2022-01-20 02:04:53 +0000
committerdrh <>2022-01-20 02:04:53 +0000
commitd6b44ec32a5709cb56cc6f9d9a80c1a336f1a53c (patch)
treee955b30dbd7eccc96bfefd718cff23beffb8f09e /src/wal.c
parent29a7bbffba41d55b9606d3dd8073dc54c9eb89e9 (diff)
downloadsqlite-d6b44ec32a5709cb56cc6f9d9a80c1a336f1a53c.tar.gz
sqlite-d6b44ec32a5709cb56cc6f9d9a80c1a336f1a53c.zip
Fix the ability to read read-only WAL-mode database when -shm is present,
([00ec95fcd02bb415|check-in 00ec95fcd02bb415]) so that it works for the case of 64K page size. FossilOrigin-Name: f426874e005e3c23e8a00083b7c201408e072bca413e52bfc436da6483afb0cd
Diffstat (limited to 'src/wal.c')
-rw-r--r--src/wal.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/wal.c b/src/wal.c
index a0ec91965..37930f89e 100644
--- a/src/wal.c
+++ b/src/wal.c
@@ -2520,6 +2520,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){
volatile void *pDummy; /* Dummy argument for xShmMap */
int rc; /* Return code */
u32 aSaveCksum[2]; /* Saved copy of pWal->hdr.aFrameCksum */
+ int szPage; /* Page size */
assert( pWal->bShmUnreliable );
assert( pWal->readOnly & WAL_SHM_RDONLY );
@@ -2603,7 +2604,8 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){
}
/* Allocate a buffer to read frames into */
- szFrame = pWal->hdr.szPage + WAL_FRAME_HDRSIZE;
+ szPage = walPagesize(pWal);
+ szFrame = szPage + WAL_FRAME_HDRSIZE;
aFrame = (u8 *)sqlite3_malloc64(szFrame);
if( aFrame==0 ){
rc = SQLITE_NOMEM_BKPT;
@@ -2617,7 +2619,7 @@ static int walBeginShmUnreliable(Wal *pWal, int *pChanged){
** the caller. */
aSaveCksum[0] = pWal->hdr.aFrameCksum[0];
aSaveCksum[1] = pWal->hdr.aFrameCksum[1];
- for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, pWal->hdr.szPage);
+ for(iOffset=walFrameOffset(pWal->hdr.mxFrame+1, szPage);
iOffset+szFrame<=szWal;
iOffset+=szFrame
){