Index: src/pager.c ================================================================== --- src/pager.c +++ src/pager.c @@ -16,11 +16,11 @@ ** is separate from the database file. The pager also implements file ** locking to prevent two processes from writing the same database ** file simultaneously, or one process from reading the database while ** another is writing. ** -** @(#) $Id: pager.c,v 1.317 2007/04/05 05:46:14 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.318 2007/04/05 08:40:32 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" #include "os.h" #include "pager.h" @@ -3032,10 +3032,16 @@ /* This can happen after a truncation in exclusive mode. The pager ** cache contains pages that are located after the end of the ** database file. Zero such pages before returning. Not doing this ** was causing the problem reported in ticket #2285. */ + if( pPager->errCode ){ + /* This case catches an IO error in sqlite3PagerPagecount(). If + ** the error occured, PagerPagecount() returned 0. + */ + return pPager->errCode; + } memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize); } TEST_INCR(pPager->nHit); page_ref(pPg); }