diff options
author | dan <dan@noemail.net> | 2015-11-17 20:56:06 +0000 |
---|---|---|
committer | dan <dan@noemail.net> | 2015-11-17 20:56:06 +0000 |
commit | fe33e39ba6236cab021c6615edc14ca113b26b20 (patch) | |
tree | c0254bbf432e5ccd61c1fa38cffd08b0b8ecf641 /src/os_unix.c | |
parent | bfe8bd5a5ed89205b0174e6d5174795002c55fab (diff) | |
download | sqlite-fe33e39ba6236cab021c6615edc14ca113b26b20.tar.gz sqlite-fe33e39ba6236cab021c6615edc14ca113b26b20.zip |
When using mmap mode on unix, use a read-only mapping by default. Write to the database file using write(). Unless SQLITE_MMAP_READWRITE is defined, in which case use a read/write mapping and write into the file using memcpy().
FossilOrigin-Name: 67c5d3c646c8198c8637069140aca952b802df25
Diffstat (limited to 'src/os_unix.c')
-rw-r--r-- | src/os_unix.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c index b322d238e..3d4524296 100644 --- a/src/os_unix.c +++ b/src/os_unix.c @@ -3349,7 +3349,7 @@ static int unixWrite( } #endif -#if SQLITE_MAX_MMAP_SIZE>0 +#if defined(SQLITE_MMAP_READWRITE) && SQLITE_MAX_MMAP_SIZE>0 /* Deal with as much of this write request as possible by transfering ** data from the memory mapping using memcpy(). */ if( offset<pFile->mmapSize ){ @@ -4774,7 +4774,9 @@ static void unixRemapfile( assert( pFd->mmapSizeActual>=pFd->mmapSize ); assert( MAP_FAILED!=0 ); +#ifdef SQLITE_MMAP_READWRITE if( (pFd->ctrlFlags & UNIXFILE_RDONLY)==0 ) flags |= PROT_WRITE; +#endif if( pOrig ){ #if HAVE_MREMAP |