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:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user