diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/btree.c | 9 | ||||
-rw-r--r-- | src/pager.c | 4 |
2 files changed, 9 insertions, 4 deletions
diff --git a/src/btree.c b/src/btree.c index b7da8cdb4..a7e4605ad 100644 --- a/src/btree.c +++ b/src/btree.c @@ -9,7 +9,7 @@ ** May you share freely, never taking more than you give. ** ************************************************************************* -** $Id: btree.c,v 1.578 2009/03/25 15:43:09 danielk1977 Exp $ +** $Id: btree.c,v 1.579 2009/03/28 10:54:23 danielk1977 Exp $ ** ** This file implements a external (disk-based) database using BTrees. ** See the header comment on "btreeInt.h" for additional information. @@ -4427,8 +4427,15 @@ static int allocateBtreePage( ** at the end of the file instead of one. The first allocated page ** becomes a new pointer-map page, the second is used by the caller. */ + MemPage *pPg = 0; TRACE(("ALLOCATE: %d from end of file (pointer-map page)\n", *pPgno)); assert( *pPgno!=PENDING_BYTE_PAGE(pBt) ); + rc = sqlite3BtreeGetPage(pBt, *pPgno, &pPg, 0); + if( rc==SQLITE_OK ){ + rc = sqlite3PagerWrite(pPg->pDbPage); + releasePage(pPg); + } + if( rc ) return rc; (*pPgno)++; if( *pPgno==PENDING_BYTE_PAGE(pBt) ){ (*pPgno)++; } } diff --git a/src/pager.c b/src/pager.c index 7de121715..9e2ae675b 100644 --- a/src/pager.c +++ b/src/pager.c @@ -18,7 +18,7 @@ ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.574 2009/03/28 06:59:41 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.575 2009/03/28 10:54:23 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -3431,11 +3431,9 @@ static int readDbPage(PgHdr *pPg){ memset(pPg->pData, 0, pPager->pageSize); return SQLITE_OK; } - iOffset = (pgno-1)*(i64)pPager->pageSize; rc = sqlite3OsRead(pPager->fd, pPg->pData, pPager->pageSize, iOffset); if( rc==SQLITE_IOERR_SHORT_READ ){ - memset(pPg->pData, 0, pPager->pageSize); rc = SQLITE_OK; } if( pgno==1 ){ |