diff options
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 10 |
1 files changed, 4 insertions, 6 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 ){ |