From: danielk1977 Date: Sat, 28 Mar 2009 06:59:41 +0000 (+0000) Subject: Fix readDbPage() so that if an SQLITE_IOERR_SHORT_READ is encountered, the page conte... X-Git-Tag: version-3.6.15~355 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=546820e3211f231e2ca9923d1b833047db514448;p=thirdparty%2Fsqlite.git Fix readDbPage() so that if an SQLITE_IOERR_SHORT_READ is encountered, the page content is zeroed. Ticket #3756. (CVS 6395) FossilOrigin-Name: 647e3b156e32e37debd60b0079fc5a52bdc9b8c8 --- diff --git a/manifest b/manifest index 2ddf4fa7ba..1c6dd2b163 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C When\s"PRAGMA\scase_sensitive_like"\sis\sinvoked,\soverride\sall\sexisting\s"LIKE"\sfunctions,\sincluding\sUTF-16\sversions.\s(CVS\s6394) -D 2009-03-27T15:26:03 +C Fix\sreadDbPage()\sso\sthat\sif\san\sSQLITE_IOERR_SHORT_READ\sis\sencountered,\sthe\spage\scontent\sis\szeroed.\sTicket\s#3756.\s(CVS\s6395) +D 2009-03-28T06:59:41 F Makefile.arm-wince-mingw32ce-gcc fcd5e9cd67fe88836360bb4f9ef4cb7f8e2fb5a0 F Makefile.in 583e87706abc3026960ed759aff6371faf84c211 F Makefile.linux-gcc d53183f4aa6a9192d249731c90dbdffbd2c68654 @@ -143,7 +143,7 @@ F src/os_common.h 8c61457df58f1a4bd5f5adc3e90e01b37bf7afbc F src/os_os2.c bed77dc26e3a95ce4a204936b9a1ca6fe612fcc5 F src/os_unix.c 7bf3ebde13154a97f797df1551d19cf0d2785c15 F src/os_win.c 40636702058ed4dcd35d68151bfab56d4997cdc1 -F src/pager.c 6a932669c9cd779aa03f111f1a89bc1bcf7a6465 +F src/pager.c 15eaf3d021eb723eda997fff735894c63d1709ee F src/pager.h 0c9f3520c00d8a3b8e792ca56c9a11b6b02b4b0f F src/parse.y b9ba0946a13e9f32a96044e64a3e8780269b08b0 F src/pcache.c fcf7738c83c4d3e9d45836b2334c8a368cc41274 @@ -710,7 +710,7 @@ F tool/speedtest16.c c8a9c793df96db7e4933f0852abb7a03d48f2e81 F tool/speedtest2.tcl ee2149167303ba8e95af97873c575c3e0fab58ff F tool/speedtest8.c 2902c46588c40b55661e471d7a86e4dd71a18224 F tool/speedtest8inst1.c 293327bc76823f473684d589a8160bde1f52c14e -P 47ffc4dca8f106d0da8cbc0a8ff7453016e9b40d -R 23b49298724349268429293de172be20 +P 1c6521e53b846eec2e046b1e9c04c60658b8e0e8 +R da48fdac6a4a2b2b9c15821945f51306 U danielk1977 -Z be074c2bfafbf3137c382192388f787a +Z dda6d9cc6d12af5a3d60408416c6d5d6 diff --git a/manifest.uuid b/manifest.uuid index 202e6b75a3..5a98b72d9e 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -1c6521e53b846eec2e046b1e9c04c60658b8e0e8 \ No newline at end of file +647e3b156e32e37debd60b0079fc5a52bdc9b8c8 \ No newline at end of file diff --git a/src/pager.c b/src/pager.c index e17bcf5bdb..7de1217157 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.573 2009/03/26 17:13:06 danielk1977 Exp $ +** @(#) $Id: pager.c,v 1.574 2009/03/28 06:59:41 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" @@ -3429,10 +3429,15 @@ static int readDbPage(PgHdr *pPg){ if( !isOpen(pPager->fd) ){ assert( pPager->tempFile ); memset(pPg->pData, 0, pPager->pageSize); - return SQLITE_IOERR_SHORT_READ; + 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 ){ u8 *dbFileVers = &((u8*)pPg->pData)[24]; memcpy(&pPager->dbFileVers, dbFileVers, sizeof(pPager->dbFileVers)); @@ -3816,7 +3821,7 @@ int sqlite3PagerAcquire( }else{ assert( pPg->pPager==pPager ); rc = readDbPage(pPg); - if( rc!=SQLITE_OK && rc!=SQLITE_IOERR_SHORT_READ ){ + if( rc!=SQLITE_OK ){ pagerDropPage(pPg); return rc; }