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

Fix a race condition during hot-journal rollback that could theoretically cause spurious corruption errors.

FossilOrigin-Name: 20ea53ddf590a9dd19501fabd2bfdb9c10b5eb265cd2995bdb335769c936c763
This commit is contained in:
dan
2023-01-31 20:21:06 +00:00
parent f7af9ba13c
commit ca3aabdf53
5 changed files with 145 additions and 16 deletions

View File

@@ -485,6 +485,9 @@ static int tvfsLock(sqlite3_file *pFile, int eLock){
tvfsExecTcl(p, "xLock", Tcl_NewStringObj(pFd->zFilename, -1),
Tcl_NewStringObj(zLock, -1), 0, 0);
}
if( p->mask&TESTVFS_LOCK_MASK && tvfsInjectIoerr(p) ){
return SQLITE_IOERR_LOCK;
}
return sqlite3OsLock(pFd->pReal, eLock);
}
@@ -500,7 +503,7 @@ static int tvfsUnlock(sqlite3_file *pFile, int eLock){
tvfsExecTcl(p, "xUnlock", Tcl_NewStringObj(pFd->zFilename, -1),
Tcl_NewStringObj(zLock, -1), 0, 0);
}
if( p->mask&TESTVFS_WRITE_MASK && tvfsInjectIoerr(p) ){
if( p->mask&TESTVFS_UNLOCK_MASK && tvfsInjectIoerr(p) ){
return SQLITE_IOERR_UNLOCK;
}
return sqlite3OsUnlock(pFd->pReal, eLock);