diff options
author | drh <drh@noemail.net> | 2011-10-11 18:18:54 +0000 |
---|---|---|
committer | drh <drh@noemail.net> | 2011-10-11 18:18:54 +0000 |
commit | 3ec4a0c1a5bd314d2bb97f741e9ff49a1811ea5f (patch) | |
tree | 02ca47d2e87e2efe7b3bbd6e0bb6fa4eeb04e359 /src/os_unix.c | |
parent | 59eedf7925f06e8373b226e50e95e1b802034a7b (diff) | |
download | sqlite-3ec4a0c1a5bd314d2bb97f741e9ff49a1811ea5f.tar.gz sqlite-3ec4a0c1a5bd314d2bb97f741e9ff49a1811ea5f.zip |
Change the behavior of the readonly_shm=1 query parameter so that it never
attempts to open the -shm file read/write.
FossilOrigin-Name: f1364004836078378e4005ab3eb9c0a04e3d4ce7
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index a23a76234..6e87a4bfd 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3854,16 +3854,15 @@ static int unixOpenSharedMemory(unixFile *pDbFd){ } if( pInode->bProcessLock==0 ){ - pShmNode->h = robust_open(zShmFilename, O_RDWR|O_CREAT, - (sStat.st_mode & 0777)); + const char *zRO; + int openFlags = O_RDWR | O_CREAT; + zRO = sqlite3_uri_parameter(pDbFd->zPath, "readonly_shm"); + if( zRO && sqlite3GetBoolean(zRO) ){ + openFlags = O_RDONLY; + pShmNode->isReadonly = 1; + } + pShmNode->h = robust_open(zShmFilename, openFlags, (sStat.st_mode&0777)); if( pShmNode->h<0 ){ - const char *zRO; - zRO = sqlite3_uri_parameter(pDbFd->zPath, "readonly_shm"); - if( zRO && sqlite3GetBoolean(zRO) ){ - pShmNode->h = robust_open(zShmFilename, O_RDONLY, - (sStat.st_mode & 0777)); - pShmNode->isReadonly = 1; - } if( pShmNode->h<0 ){ rc = unixLogError(SQLITE_CANTOPEN_BKPT, "open", zShmFilename); goto shm_open_err; |