diff options
author | drh <drh@noemail.net> | 2008-04-14 23:13:45 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2008-04-14 23:13:45 +0000 |
commit | 4c02a23557ee11d0d3e942fc008cd16ea5e5de8c (patch) | |
tree | 50bb1e4d83bbc318c91fe689ede52cd98877c076 /src | |
parent | 57ee05248d0f6dc6c959acd0fd78850dd59de6db (diff) | |
download | sqlite-4c02a23557ee11d0d3e942fc008cd16ea5e5de8c.tar.gz sqlite-4c02a23557ee11d0d3e942fc008cd16ea5e5de8c.zip |
Do not attempt to write to temporary database files that have never
been opened. (CVS 5007)
FossilOrigin-Name: 7bb9a4165afb96043dfeffad21eb51591a1fd2dd
Diffstat (limited to 'src')
-rw-r--r-- | src/pager.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/pager.c b/src/pager.c index c4217541a..7473b18cc 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.425 2008/04/14 16:37:10 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.426 2008/04/14 23:13:46 drh Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -1502,11 +1502,16 @@ static int pager_playback_one_page( ** locked. (2) we know that the original page content is fully synced ** in the main journal either because the page is not in cache or else ** the page is marked as needSync==0. + ** + ** 2008-04-14: When attempting to vacuum a corrupt database file, it + ** is possible to fail a statement on a database that does not yet exist. + ** Do not attempt to write if database file has never been opened. */ pPg = pager_lookup(pPager, pgno); PAGERTRACE4("PLAYBACK %d page %d hash(%08x)\n", PAGERID(pPager), pgno, pager_datahash(pPager->pageSize, aData)); - if( pPager->state>=PAGER_EXCLUSIVE && (pPg==0 || pPg->needSync==0) ){ + if( pPager->state>=PAGER_EXCLUSIVE && (pPg==0 || pPg->needSync==0) + && pPager->fd->pMethods ){ i64 offset = (pgno-1)*(i64)pPager->pageSize; rc = sqlite3OsWrite(pPager->fd, aData, pPager->pageSize, offset); if( pPg ){ |