diff options
author | dan <Dan Kennedy> | 2023-11-07 20:11:49 +0000 |
---|---|---|
committer | dan <Dan Kennedy> | 2023-11-07 20:11:49 +0000 |
commit | 275234e3206758df0143dad63cf7aa8802c317f9 (patch) | |
tree | a19161ec8bf3ad55b311615c7e2b6c408b333fe4 /src/os_unix.c | |
parent | 344255e5aaddbb5b9ba5aba44d7aea124baec1b5 (diff) | |
download | sqlite-275234e3206758df0143dad63cf7aa8802c317f9.tar.gz sqlite-275234e3206758df0143dad63cf7aa8802c317f9.zip |
Fix an assert() that could fail within calls to sqlite3_snapshot_open() in SQLITE_ENABLE_SETLK_TIMEOUT builds.
FossilOrigin-Name: 84634bc268e5c80146f3f3b2e13118f239c9a7e4e4e9dfcaccef2b17252ce53b
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index a33e6f4df..cd3e0fc54 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -4980,12 +4980,15 @@ static int unixShmLock( ** It is not permitted to block on the RECOVER lock. */ #ifdef SQLITE_ENABLE_SETLK_TIMEOUT - assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || ( - (ofst!=2) /* not RECOVER */ - && (ofst!=1 || (p->exclMask|p->sharedMask)==0) - && (ofst!=0 || (p->exclMask|p->sharedMask)<3) - && (ofst<3 || (p->exclMask|p->sharedMask)<(1<<ofst)) - )); + { + u16 lockMask = (p->exclMask|p->sharedMask); + assert( (flags & SQLITE_SHM_UNLOCK) || pDbFd->iBusyTimeout==0 || ( + (ofst!=2) /* not RECOVER */ + && (ofst!=1 || lockMask==0 || lockMask==2) + && (ofst!=0 || lockMask<3) + && (ofst<3 || lockMask<(1<<ofst)) + )); + } #endif mask = (1<<(ofst+n)) - (1<<ofst); |