1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-08 14:02:16 +03:00

Move the write failure test in memjrnlCreateFile() to just after the

actual write, thus reducing the number of instances of the test by one.

FossilOrigin-Name: 7f00d80c63b15376391f661d872f2b29a970702d
This commit is contained in:
drh
2016-03-09 03:44:32 +00:00
parent c1fb2b87bd
commit 769b4c95ca
3 changed files with 9 additions and 8 deletions

View File

@@ -145,13 +145,14 @@ static int memjrnlCreateFile(MemJournal *p){
int nChunk = copy.nChunkSize;
i64 iOff = 0;
FileChunk *pIter;
for(pIter=copy.pFirst; pIter && rc==SQLITE_OK; pIter=pIter->pNext){
for(pIter=copy.pFirst; pIter; pIter=pIter->pNext){
int nWrite = nChunk;
if( pIter==copy.endpoint.pChunk ){
nWrite = copy.endpoint.iOffset % copy.nChunkSize;
if( nWrite==0 ) nWrite = copy.nChunkSize;
}
rc = sqlite3OsWrite(pReal, (u8*)pIter->zChunk, nWrite, iOff);
if( rc ) break;
iOff += nWrite;
}
if( rc==SQLITE_OK ){