aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordrh <drh@noemail.net>2019-08-06 20:55:06 +0000
committerdrh <drh@noemail.net>2019-08-06 20:55:06 +0000
commit55220a6c7016750ad316a985d2b887ed58b017ad (patch)
treea1c4df07b69069755869da0aeb20134df6927183 /src/os_unix.c
parenta2de66c6b4f7a89f55cfd4098d27f8b031e29229 (diff)
downloadsqlite-55220a6c7016750ad316a985d2b887ed58b017ad.tar.gz
sqlite-55220a6c7016750ad316a985d2b887ed58b017ad.zip
Improved reuse of file descriptors for which close() is delayed to prevent
clearly of posix advisory locks. FossilOrigin-Name: 509c1ba26a4c12c63ecf04ddfa2f175eaf4dd9b96ab7be15faebd36deb0a0a31
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 0a7c4bb46..3c1d48a4d 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5770,6 +5770,7 @@ static UnixUnusedFd *findReusableFd(const char *zPath, int flags){
UnixUnusedFd **pp;
assert( sqlite3_mutex_notheld(pInode->pLockMutex) );
sqlite3_mutex_enter(pInode->pLockMutex);
+ flags &= (SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE);
for(pp=&pInode->pUnused; *pp && (*pp)->flags!=flags; pp=&((*pp)->pNext));
pUnused = *pp;
if( pUnused ){
@@ -6073,7 +6074,8 @@ static int unixOpen(
if( p->pPreallocatedUnused ){
p->pPreallocatedUnused->fd = fd;
- p->pPreallocatedUnused->flags = flags;
+ p->pPreallocatedUnused->flags =
+ flags & (SQLITE_OPEN_READONLY|SQLITE_OPEN_READWRITE);
}
if( isDelete ){