Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Catch an IO error case introduced by (3808). (CVS 3809) |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
383a08e26083964e79bfe22156f5f554 |
User & Date: | danielk1977 2007-04-05 08:40:32.000 |
Context
2007-04-05
| ||
11:25 | Improvements to coverage testing. (CVS 3810) (check-in: 38af156da8 user: drh tags: trunk) | |
08:40 | Catch an IO error case introduced by (3808). (CVS 3809) (check-in: 383a08e260 user: danielk1977 tags: trunk) | |
05:46 | Zero cached pages located beyond the end of the file before returning them. Ticket #2285. (CVS 3808) (check-in: 5180810eea user: danielk1977 tags: trunk) | |
Changes
Changes to src/pager.c.
︙ | ︙ | |||
14 15 16 17 18 19 20 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** 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. ** | | | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | ** The pager is used to access a database disk file. It implements ** atomic commit and rollback through the use of a journal file that ** 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.318 2007/04/05 08:40:32 danielk1977 Exp $ */ #ifndef SQLITE_OMIT_DISKIO #include "sqliteInt.h" #include "os.h" #include "pager.h" #include <assert.h> #include <string.h> |
︙ | ︙ | |||
3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 | assert(pPager->nRef>0 || pgno==1); if( pgno>sqlite3PagerPagecount(pPager) ){ /* 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. */ memset(PGHDR_TO_DATA(pPg), 0, pPager->pageSize); } TEST_INCR(pPager->nHit); page_ref(pPg); } *ppPage = pPg; return SQLITE_OK; | > > > > > > | 3030 3031 3032 3033 3034 3035 3036 3037 3038 3039 3040 3041 3042 3043 3044 3045 3046 3047 3048 3049 | assert(pPager->nRef>0 || pgno==1); if( pgno>sqlite3PagerPagecount(pPager) ){ /* 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); } *ppPage = pPg; return SQLITE_OK; |
︙ | ︙ |