1
0
mirror of https://github.com/sqlite/sqlite.git synced 2025-11-11 01:42:22 +03:00

Fix a locking race condition in Windows 10 that can occur when two or more

processes attempt to recover the same hot journal at the same time.

FossilOrigin-Name: 38a4e9d92887898b779493c71e4500f777a4e2e7
This commit is contained in:
drh
2016-04-20 18:31:27 +00:00
parent a6dddd9bde
commit 333f80562b
3 changed files with 9 additions and 10 deletions

View File

@@ -3169,9 +3169,8 @@ static int winLock(sqlite3_file *id, int locktype){
** the PENDING_LOCK byte is temporary.
*/
newLocktype = pFile->locktype;
if( (pFile->locktype==NO_LOCK)
|| ( (locktype==EXCLUSIVE_LOCK)
&& (pFile->locktype==RESERVED_LOCK))
if( pFile->locktype==NO_LOCK
|| (locktype==EXCLUSIVE_LOCK && pFile->locktype<=RESERVED_LOCK)
){
int cnt = 3;
while( cnt-->0 && (res = winLockFile(&pFile->h, SQLITE_LOCKFILE_FLAGS,