mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
Corrections to Win32 lock detection for SHM files.
FossilOrigin-Name: 3a91be975daee65c3e1199855613066015d5df8ad44ababdef31d1c698b5e746
This commit is contained in:
@@ -2105,7 +2105,8 @@ static int winIoerrRetryDelay = SQLITE_WIN32_IOERR_RETRY_DELAY;
|
||||
** to file locking.
|
||||
*/
|
||||
#if !defined(winIsLockingError)
|
||||
#define winIsLockingError(a) (((a)==ERROR_LOCK_VIOLATION) || \
|
||||
#define winIsLockingError(a) (((a)==ERROR_ACCESS_DENIED) || \
|
||||
((a)==ERROR_LOCK_VIOLATION) || \
|
||||
((a)==ERROR_IO_PENDING))
|
||||
#endif
|
||||
|
||||
@@ -3867,14 +3868,16 @@ static int winGetShmDmsLockType(
|
||||
pOverlapped = &overlapped;
|
||||
#endif
|
||||
if( !osWriteFile(pFile->h, ¬Used1, 1, ¬Used2, pOverlapped) ){
|
||||
DWORD lastErrno = osGetLastError();
|
||||
if( !osReadFile(pFile->h, ¬Used1, 1, ¬Used2, pOverlapped) ){
|
||||
if( winIsLockingError(osGetLastError()) ){
|
||||
lastErrno = osGetLastError();
|
||||
if( winIsLockingError(lastErrno) ){
|
||||
*pLockType = WINSHM_WRLCK;
|
||||
}else{
|
||||
return SQLITE_IOERR_READ;
|
||||
}
|
||||
}else{
|
||||
if( winIsLockingError(osGetLastError()) ){
|
||||
if( winIsLockingError(lastErrno) ){
|
||||
*pLockType = WINSHM_RDLCK;
|
||||
}else{
|
||||
return SQLITE_IOERR_WRITE;
|
||||
|
||||
Reference in New Issue
Block a user