diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/os_unix.c | 10 | ||||
-rw-r--r-- | src/pager.c | 10 |
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; |