aboutsummaryrefslogtreecommitdiff
path: root/src/os_unix.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/os_unix.c')
-rw-r--r--src/os_unix.c18
1 files changed, 12 insertions, 6 deletions
diff --git a/src/os_unix.c b/src/os_unix.c
index a97aba87f..00c0088f8 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -4591,13 +4591,16 @@ static int unixFetch(sqlite3_file *fd, i64 iOff, int nAmt, void **pp){
}
/*
-** If the second argument is non-NULL, then this function releases a
-** reference obtained by an earlier call to unixFetch(). Or, if the second
-** argument is NULL, then this function is being called to inform the VFS
-** layer that, according to POSIX, any existing mapping may now be invalid
-** and should be unmapped.
+** If the third argument is non-NULL, then this function releases a
+** reference obtained by an earlier call to unixFetch(). The second
+** argument passed to this function must be the same as the corresponding
+** argument that was passed to the unixFetch() invocation.
+**
+** Or, if the third argument is NULL, then this function is being called
+** to inform the VFS layer that, according to POSIX, any existing mapping
+** may now be invalid and should be unmapped.
*/
-static int unixUnfetch(sqlite3_file *fd, void *p){
+static int unixUnfetch(sqlite3_file *fd, i64 iOff, void *p){
unixFile *pFd = (unixFile *)fd; /* The underlying database file */
/* If p==0 (unmap the entire file) then there must be no outstanding
@@ -4605,6 +4608,9 @@ static int unixUnfetch(sqlite3_file *fd, void *p){
** then there must be at least one outstanding. */
assert( (p==0)==(pFd->nFetchOut==0) );
+ /* If p!=0, it must match the iOff value. */
+ assert( p==0 || p==&((u8 *)pFd->pMapRegion)[iOff] );
+
if( p ){
pFd->nFetchOut--;
}else{