From: dan Date: Tue, 17 Nov 2015 20:56:06 +0000 (+0000) Subject: When using mmap mode on unix, use a read-only mapping by default. Write to the databa... X-Git-Tag: version-3.10.0~124 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fe33e39ba6236cab021c6615edc14ca113b26b20;p=thirdparty%2Fsqlite.git 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 --- diff --git a/manifest b/manifest index cf927a2229..41d7945788 100644 --- a/manifest +++ b/manifest @@ -1,5 +1,5 @@ -C Fix\suninitialized\svariable\sin\sthe\scommand\sline\sshell. -D 2015-11-17T19:17:14.024 +C When\susing\smmap\smode\son\sunix,\suse\sa\sread-only\smapping\sby\sdefault.\sWrite\sto\sthe\sdatabase\sfile\susing\swrite().\sUnless\sSQLITE_MMAP_READWRITE\sis\sdefined,\sin\swhich\scase\suse\sa\sread/write\smapping\sand\swrite\sinto\sthe\sfile\susing\smemcpy(). +D 2015-11-17T20:56:06.787 F Makefile.in d828db6afa6c1fa060d01e33e4674408df1942a1 F Makefile.linux-gcc 7bc79876b875010e8c8f9502eb935ca92aa3c434 F Makefile.msc e928e68168df69b353300ac87c10105206653a03 @@ -323,7 +323,7 @@ F src/os.c 8fd25588eeba74068d41102d26810e216999b6c8 F src/os.h 3e57a24e2794a94d3cf2342c6d9a884888cd96bf F src/os_common.h abdb9a191a367793268fe553d25bab894e986a0e F src/os_setup.h c9d4553b5aaa6f73391448b265b89bed0b890faa -F src/os_unix.c cf72e06e15839ebe7121e01d3eebf256c039b0ca +F src/os_unix.c eb24e0340fbe3cfd0eabfb15a71476953e54fa73 F src/os_win.c 1716291e5ec2dbfc5a1fe0b32182030f1f7d8acf F src/os_win.h eb7a47aa17b26b77eb97e4823f20a00b8bda12ca F src/pager.c 18341e2b759b447cbc82fb9215d08d9c5864e92e @@ -1403,7 +1403,7 @@ F tool/vdbe_profile.tcl 246d0da094856d72d2c12efec03250d71639d19f F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4 F tool/warnings.sh 48bd54594752d5be3337f12c72f28d2080cb630b F tool/win/sqlite.vsix deb315d026cc8400325c5863eef847784a219a2f -P eea26b6caea37422c9b46a7a3a538b0c9575f392 -R cc64f84be685bae79d5a153d40e5e973 -U mistachkin -Z 3d10a1734b384a6c71eab8ba5f61ca6f +P dc2ac024d31a898bbc3e7fc824d806e63e993234 +R 84fe0eec79106a76020c4d6d9eb9fda8 +U dan +Z e25a64e1e3c268c6ee1a9c7b42e3911f diff --git a/manifest.uuid b/manifest.uuid index b83646e075..e65363fd12 100644 --- a/manifest.uuid +++ b/manifest.uuid @@ -1 +1 @@ -dc2ac024d31a898bbc3e7fc824d806e63e993234 \ No newline at end of file +67c5d3c646c8198c8637069140aca952b802df25 \ No newline at end of file diff --git a/src/os_unix.c b/src/os_unix.c index b322d238e8..3d4524296b 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( offsetmmapSize ){ @@ -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