mirror of
https://github.com/sqlite/sqlite.git
synced 2025-11-12 13:01:09 +03:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user