aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2007-04-06 18:23:17 +0000
committerdrh <drh@noemail.net>2007-04-06 18:23:17 +0000
commitbb5f18d2ca13704d3a7e7b8ce51a677304a62f3d (patch)
treef0049262e034888f361e3290987c63b7dc277bcc /src
parent15926590ed196daf2b28481914363a9fe9172a7c (diff)
downloadsqlite-bb5f18d2ca13704d3a7e7b8ce51a677304a62f3d.tar.gz
sqlite-bb5f18d2ca13704d3a7e7b8ce51a677304a62f3d.zip
Additional coverage testing. (CVS 3823)
FossilOrigin-Name: 26b2e1aede3f776134b2d6e941d17a907843e650
Diffstat (limited to 'src')
-rw-r--r--src/os_unix.c10
-rw-r--r--src/pager.c10
2 files changed, 11 insertions, 9 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 18ae4b76c..281348b79 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -919,11 +919,7 @@ static int unixOpenDirectory(
const char *zDirname
){
unixFile *pFile = (unixFile*)id;
- if( pFile==0 ){
- /* Do not open the directory if the corresponding file is not already
- ** open. */
- return SQLITE_CANTOPEN;
- }
+ assert( pFile!=0 );
SET_THREADID(pFile);
assert( pFile->dirfd<0 );
pFile->dirfd = open(zDirname, O_RDONLY|O_BINARY, 0);
@@ -1000,10 +996,13 @@ static int seekAndRead(unixFile *id, void *pBuf, int cnt){
TIMER_START;
#if defined(USE_PREAD)
got = pread(id->h, pBuf, cnt, id->offset);
+ SimulateIOError( got = -1 );
#elif defined(USE_PREAD64)
got = pread64(id->h, pBuf, cnt, id->offset);
+ SimulateIOError( got = -1 );
#else
newOffset = lseek(id->h, id->offset, SEEK_SET);
+ SimulateIOError( newOffset-- );
if( newOffset!=id->offset ){
return -1;
}
@@ -1026,7 +1025,6 @@ static int unixRead(OsFile *id, void *pBuf, int amt){
int got;
assert( id );
got = seekAndRead((unixFile*)id, pBuf, amt);
- SimulateIOError( got = -1 );
if( got==amt ){
return SQLITE_OK;
}else if( got<0 ){
diff --git a/src/pager.c b/src/pager.c
index 83d458bc5..874333c74 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.323 2007/04/05 17:15:53 danielk1977 Exp $
+** @(#) $Id: pager.c,v 1.324 2007/04/06 18:23:18 drh Exp $
*/
#ifndef SQLITE_OMIT_DISKIO
#include "sqliteInt.h"
@@ -2508,8 +2508,12 @@ static PgHdr *pager_get_all_dirty_pages(Pager *pPager){
*/
static int hasHotJournal(Pager *pPager){
if( !pPager->useJournal ) return 0;
- if( !sqlite3OsFileExists(pPager->zJournal) ) return 0;
- if( sqlite3OsCheckReservedLock(pPager->fd) ) return 0;
+ if( !sqlite3OsFileExists(pPager->zJournal) ){
+ return 0;
+ }
+ if( sqlite3OsCheckReservedLock(pPager->fd) ){
+ return 0;
+ }
if( sqlite3PagerPagecount(pPager)==0 ){
sqlite3OsDelete(pPager->zJournal);
return 0;