1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-07 02:42:48 +03:00

Fix a problem with recovering from an IO error in exclusive-locking mode. (CVS 5112)

FossilOrigin-Name: 7a44fb965b3477fb78901939ba35d569e5638c19
This commit is contained in:
danielk1977
2008-05-09 16:57:50 +00:00
parent 7297d1f070
commit 93f7af97a6
6 changed files with 160 additions and 37 deletions

View File

@@ -9,7 +9,7 @@
** May you share freely, never taking more than you give.
**
*************************************************************************
** $Id: btree.c,v 1.457 2008/05/07 19:11:03 danielk1977 Exp $
** $Id: btree.c,v 1.458 2008/05/09 16:57:51 danielk1977 Exp $
**
** This file implements a external (disk-based) database using BTrees.
** See the header comment on "btreeInt.h" for additional information.
@@ -1644,6 +1644,7 @@ int sqlite3BtreeGetAutoVacuum(Btree *p){
static int lockBtree(BtShared *pBt){
int rc;
MemPage *pPage1;
int nPage;
assert( sqlite3_mutex_held(pBt->mutex) );
if( pBt->pPage1 ) return SQLITE_OK;
@@ -1654,7 +1655,11 @@ static int lockBtree(BtShared *pBt){
** a valid database file.
*/
rc = SQLITE_NOTADB;
if( sqlite3PagerPagecount(pBt->pPager)>0 ){
nPage = sqlite3PagerPagecount(pBt->pPager);
if( nPage<0 ){
rc = SQLITE_IOERR;
goto page1_init_failed;
}else if( nPage>0 ){
int pageSize;
int usableSize;
u8 *page1 = pPage1->aData;