1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-08-05 15:55:57 +03:00

Writes to the subjournal should be all-or-nothing. Fix for

dbsqlfuzz fe3c397fb90029313446c4e0f4a6cd0c81dd9621.

FossilOrigin-Name: 22cc55e84f67f6f39b7dba07a4ef7ae958b2d926633faec91a278922053e50c6
This commit is contained in:
drh
2022-02-08 15:14:18 +00:00
parent 4e532958c1
commit 9f4ce3b19f
3 changed files with 13 additions and 7 deletions

View File

@@ -4497,6 +4497,12 @@ static int subjournalPage(PgHdr *pPg){
if( rc==SQLITE_OK ){
rc = sqlite3OsWrite(pPager->sjfd, pData2, pPager->pageSize, offset+4);
}
if( rc!=SQLITE_OK ){
/* Subjournal writes should be "atomic" in the sense that we should
** never allow a partial write. If anything goes wrong, make sure
** to roll back any partial writes that may have occurred */
(void)sqlite3OsTruncate(pPager->sjfd, offset);
}
}
}
if( rc==SQLITE_OK ){