aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-09-04 17:30:59 +0000
committerdan <dan@noemail.net>2020-09-04 17:30:59 +0000
commit2b06b0769ed38e408b4d28406db44cda44bdbbcd (patch)
treea6cb364f5cf612762d5aea55100da3e8cba673e5 /src
parent52cfe0312a3e26267635d7bc06f145e62e9183ce (diff)
downloadsqlite-2b06b0769ed38e408b4d28406db44cda44bdbbcd.tar.gz
sqlite-2b06b0769ed38e408b4d28406db44cda44bdbbcd.zip
Ensure that the busy-handler count is reset at the end of each sqlite3_file_control() and sqlite3_prepare() (and _v2() and _v3()).
FossilOrigin-Name: 5dd05940617fb05ee2faf212b15afc3a8e9695318eccb76761b37359fea681d1
Diffstat (limited to 'src')
-rw-r--r--src/main.c2
-rw-r--r--src/os_unix.c1
-rw-r--r--src/prepare.c1
3 files changed, 4 insertions, 0 deletions
diff --git a/src/main.c b/src/main.c
index 2cc092e92..cc1464f13 100644
--- a/src/main.c
+++ b/src/main.c
@@ -3852,7 +3852,9 @@ int sqlite3_file_control(sqlite3 *db, const char *zDbName, int op, void *pArg){
}
rc = SQLITE_OK;
}else{
+ int nSave = db->busyHandler.nBusy;
rc = sqlite3OsFileControl(fd, op, pArg);
+ db->busyHandler.nBusy = nSave;
}
sqlite3BtreeLeave(pBtree);
}
diff --git a/src/os_unix.c b/src/os_unix.c
index 5419a042a..ac5c33e82 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -2145,6 +2145,7 @@ static int unixClose(sqlite3_file *id){
}
sqlite3_mutex_leave(pInode->pLockMutex);
releaseInodeInfo(pFile);
+ assert( pFile->pShm==0 );
rc = closeUnixFile(id);
unixLeaveMutex();
return rc;
diff --git a/src/prepare.c b/src/prepare.c
index dac12d8a5..13fd1d33b 100644
--- a/src/prepare.c
+++ b/src/prepare.c
@@ -746,6 +746,7 @@ static int sqlite3LockAndPrepare(
sqlite3BtreeLeaveAll(db);
rc = sqlite3ApiExit(db, rc);
assert( (rc&db->errMask)==rc );
+ db->busyHandler.nBusy = 0;
sqlite3_mutex_leave(db->mutex);
return rc;
}