| Index: third_party/sqlite/src/src/journal.c
|
| diff --git a/third_party/sqlite/src/src/journal.c b/third_party/sqlite/src/src/journal.c
|
| index 2f9e222089d63a2f8ed38b1cead1f69b52c6efcd..fed27be3e38055d2204395cde6ffc94589fbf5e8 100644
|
| --- a/third_party/sqlite/src/src/journal.c
|
| +++ b/third_party/sqlite/src/src/journal.c
|
| @@ -59,6 +59,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;
|
| @@ -228,6 +236,16 @@ int sqlite3JournalCreate(sqlite3_file *p){
|
| return createFile((JournalFile *)p);
|
| }
|
|
|
| +/*
|
| +** The file-handle passed as the only argument is guaranteed to be an open
|
| +** file. It may or may not be of class JournalFile. If the file is a
|
| +** JournalFile, and the underlying file on disk has not yet been opened,
|
| +** return 0. Otherwise, return 1.
|
| +*/
|
| +int sqlite3JournalExists(sqlite3_file *p){
|
| + return (p->pMethods!=&JournalFileMethods || ((JournalFile *)p)->pReal!=0);
|
| +}
|
| +
|
| /*
|
| ** Return the number of bytes required to store a JournalFile that uses vfs
|
| ** pVfs to create the underlying on-disk files.
|
|
|