aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2013-03-22 17:46:11 +0000
committerdan <dan@noemail.net>2013-03-22 17:46:11 +0000
commitc00033125d612de5877ea2682cd255dd3199c00c (patch)
tree04e5ef5b309536d4e6cac7be83dc47256e6e00ea /src/os_unix.c
parent6101d50471a97423032fbffcb72f5b62a28a90ee (diff)
downloadsqlite-c00033125d612de5877ea2682cd255dd3199c00c.tar.gz
sqlite-c00033125d612de5877ea2682cd255dd3199c00c.zip
Add a fix for the assert() statements added by the previous commit.
FossilOrigin-Name: 19345416ed5e1ab5b0b35993b0b9069c2fb1683b
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index 88f317702..2f03c3967 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -3470,6 +3470,14 @@ static int unixTruncate(sqlite3_file *id, i64 nByte){
if( pFile->inNormalWrite && nByte==0 ){
pFile->transCntrChng = 1;
}
+
+ /* If the file was just truncated to a size smaller than the currently
+ ** mapped region, reduce the effective mapping size as well. SQLite will
+ ** use read() and write() to access data beyond this point from now on.
+ */
+ if( nByte<pFile->mmapSize ){
+ pFile->mmapSize = nByte;
+ }
#endif
return SQLITE_OK;
@@ -4461,7 +4469,7 @@ static int unixMremap(
i64 nOldRnd; /* nOld rounded up */
assert( iOff==0 );
- assert( p->mmapSize==nOld );
+ /* assert( p->mmapSize==nOld ); */
assert( p->pMapRegion==0 || p->pMapRegion==(*ppMap) );
/* If the SQLITE_MREMAP_EXTEND flag is set, then the size of the requested