summaryrefslogtreecommitdiff
path: root/dist/sqlite3.c
diff options
context:
space:
mode:
Diffstat (limited to 'dist/sqlite3.c')
-rw-r--r--dist/sqlite3.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/dist/sqlite3.c b/dist/sqlite3.c
index 9d01a51..11e6528 100644
--- a/dist/sqlite3.c
+++ b/dist/sqlite3.c
@@ -72614,6 +72614,14 @@ static int createFile(JournalFile *p){
assert(p->iSize<=p->nBuf);
rc = sqlite3OsWrite(p->pReal, p->zBuf, p->iSize, 0);
}
+ if( rc!=SQLITE_OK ){
+ /* If an error occurred while writing to the file, close it before
+ ** returning. This way, SQLite uses the in-memory journal data to
+ ** roll back changes made to the internal page-cache before this
+ ** function was called. */
+ sqlite3OsClose(pReal);
+ p->pReal = 0;
+ }
}
}
return rc;