diff options
author | dan <dan@noemail.net> | 2010-07-07 11:05:21 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2010-07-07 11:05:21 +0000 |
commit | 78f1e53840c5ca67f1d60e415f458210a73795e2 (patch) | |
tree | 2eae4625d20b7b3f2597554006f2dd0b877bab27 /ext/async/sqlite3async.c | |
parent | bd0e9070e5edcfed7542d0edc46e5f95118eaeb3 (diff) | |
download | sqlite-78f1e53840c5ca67f1d60e415f458210a73795e2.tar.gz sqlite-78f1e53840c5ca67f1d60e415f458210a73795e2.zip |
Change the async-IO extension to return SQLITE_IOERR_SHORT_READ when appropriate. This prevents a valgrind warning in the test suite.
FossilOrigin-Name: d9e3287900ae4aa7722ad0132bb8d6cd2755d3a6
Diffstat (limited to 'ext/async/sqlite3async.c')
-rw-r--r-- | ext/async/sqlite3async.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/ext/async/sqlite3async.c b/ext/async/sqlite3async.c index 127942bca..65399a57a 100644 --- a/ext/async/sqlite3async.c +++ b/ext/async/sqlite3async.c @@ -667,7 +667,7 @@ static int asyncRead( ){ AsyncFileData *p = ((AsyncFile *)pFile)->pData; int rc = SQLITE_OK; - sqlite3_int64 filesize; + sqlite3_int64 filesize = 0; sqlite3_file *pBase = p->pBaseRead; sqlite3_int64 iAmt64 = (sqlite3_int64)iAmt; @@ -706,6 +706,7 @@ static int asyncRead( )){ sqlite3_int64 nCopy; sqlite3_int64 nByte64 = (sqlite3_int64)pWrite->nByte; + filesize = MAX(filesize, pWrite->iOffset+nByte64); /* Set variable iBeginIn to the offset in buffer pWrite->zBuf[] from ** which data should be copied. Set iBeginOut to the offset within @@ -728,6 +729,9 @@ static int asyncRead( asyncread_out: async_mutex_leave(ASYNC_MUTEX_QUEUE); + if( rc==SQLITE_OK && filesize<(iOffset+iAmt) ){ + rc = SQLITE_IOERR_SHORT_READ; + } return rc; } |