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

Omit unnecessary branches from the unixIsSharingShmNode() implementation.

FossilOrigin-Name: 2d5623bc27073c407ec63e401f095d12f0025dd276a0bdc26d8b94b1f13c9a36
This commit is contained in:
drh
2025-10-27 23:57:57 +00:00
parent e34f35c833
commit db0d47b749
3 changed files with 10 additions and 9 deletions

View File

@@ -4660,13 +4660,14 @@ static int unixIsSharingShmNode(unixFile *pFile){
pShmNode = pFile->pShm->pShmNode;
rc = 1;
unixEnterMutex();
if( pShmNode->nRef==1 ){
if( ALWAYS(pShmNode->nRef==1) ){
struct flock lock;
lock.l_whence = SEEK_SET;
lock.l_start = UNIX_SHM_DMS;
lock.l_len = 1;
lock.l_type = F_WRLCK;
if( osFcntl(pShmNode->hShm, F_GETLK, &lock)==0 && lock.l_type==F_UNLCK ){
osFcntl(pShmNode->hShm, F_GETLK, &lock);
if( lock.l_type==F_UNLCK ){
rc = 0;
}
}