Do not attempt to write to temporary database files that have never

been opened. (CVS 5007)

FossilOrigin-Name: 7bb9a4165afb96043dfeffad21eb51591a1fd2dd
This commit is contained in:
drh 2008-04-14 23:13:45 +00:00
parent 57ee05248d
commit 4c02a23557
3 changed files with 15 additions and 10 deletions

View File

@ -1,5 +1,5 @@
C Fix\s#3053:\sbashism\s(CVS\s5006)
D 2008-04-14T22:57:55
C Do\snot\sattempt\sto\swrite\sto\stemporary\sdatabase\sfiles\sthat\shave\snever\nbeen\sopened.\s(CVS\s5007)
D 2008-04-14T23:13:46
F Makefile.arm-wince-mingw32ce-gcc ac5f7b2cef0cd850d6f755ba6ee4ab961b1fadf7
F Makefile.in 25b3282a4ac39388632c2fb0e044ff494d490952
F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654
@ -128,7 +128,7 @@ F src/os_unix.c fdec4e5ee5dd555a6ad4a69f38ab35f0788536b4
F src/os_unix.h 5768d56d28240d3fe4537fac08cc85e4fb52279e
F src/os_win.c 3a60bddd07ea6f8adb2314dd5996ac97b988f403
F src/os_win.h 41a946bea10f61c158ce8645e7646b29d44f122b
F src/pager.c e21ab9dd60bbb09e8ad26a520abf4113f21bae44
F src/pager.c fc7c415f2a5dee4f47ac3feb33d016c2ff2f09c0
F src/pager.h b1e2258f03878c14b06a95bfa362e8c5c9638170
F src/parse.y bc1b1cc6f86a0e0b669abdd88ddbdc7c8b67318d
F src/pragma.c e659c9e443d11854cff2fd250012365ae0ca81ba
@ -628,7 +628,7 @@ F www/tclsqlite.tcl 8be95ee6dba05eabcd27a9d91331c803f2ce2130
F www/vdbe.tcl 87a31ace769f20d3627a64fa1fade7fed47b90d0
F www/version3.tcl 890248cf7b70e60c383b0e84d77d5132b3ead42b
F www/whentouse.tcl fc46eae081251c3c181bd79c5faef8195d7991a5
P c9e0d625bcf3ff24229d7f011b4cfbd8d8140d16
R b99584578ba71d73be93cc5ec611b93c
U mlcreech
Z 937fab50b0ba41d923f3f3b76e0967cc
P 7217cecee71fbc992acd07b4ac90c1929e2207ae
R 194436d9ba6587c6c80b28e6a123a043
U drh
Z 2222b7c4e7fa12d7b54bcf1718d13c6d

View File

@ -1 +1 @@
7217cecee71fbc992acd07b4ac90c1929e2207ae
7bb9a4165afb96043dfeffad21eb51591a1fd2dd

View File

@ -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 ){