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

Do not attempt to take any write lock on a read-only database on Windows.

FossilOrigin-Name: a47ff0cdab0f82398c68ea770053f193f4812a51
This commit is contained in:
drh
2015-05-28 00:54:35 +00:00
parent 3da29a112a
commit 275fe3adf1
4 changed files with 76 additions and 7 deletions

View File

@@ -3015,6 +3015,12 @@ static int winLock(sqlite3_file *id, int locktype){
return SQLITE_OK;
}
/* Do not allow any kind of write-lock on a read-only database
*/
if( (pFile->ctrlFlags & WINFILE_RDONLY)!=0 && locktype>=RESERVED_LOCK ){
return SQLITE_IOERR_LOCK;
}
/* Make sure the locking sequence is correct
*/
assert( pFile->locktype!=NO_LOCK || locktype==SHARED_LOCK );