Skip to content

Commit 507c90a

Browse files
committed
More conservative verification reading of page 1
Use PAGER_GET_READONLY flag and pagerUnlockIfUnused() unlocking.
1 parent d886746 commit 507c90a

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

sqleet.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,8 @@ static int codec_set_to(Codec *codec, Btree *pBt)
432432
/* Non-empty database, read page 1 with the codec */
433433
DbPage *page;
434434
sqlite3PcacheClear(pager->pPCache);
435-
if ((rc = sqlite3PagerGet(pager, 1, &page, 0)) == SQLITE_OK) {
435+
rc = sqlite3PagerGet(pager, 1, &page, PAGER_GET_READONLY);
436+
if (rc == SQLITE_OK) {
436437
rc = SQLITE_NOTADB;
437438
if (!memcmp(page->pData, "SQLite format 3", 16)) {
438439
const uint8_t *data = page->pData;
@@ -464,7 +465,7 @@ static int codec_set_to(Codec *codec, Btree *pBt)
464465
rc = SQLITE_OK;
465466
}
466467

467-
pager_unlock(pager);
468+
pagerUnlockIfUnused(pager);
468469
sqlite3BtreeLeave(pBt);
469470
return rc;
470471

0 commit comments

Comments
 (0)