aboutsummaryrefslogtreecommitdiff
path: root/ext/lsm1/lsm_unix.c
diff options
context:
space:
mode:
authordan <dan@noemail.net>2020-07-13 18:04:27 +0000
committerdan <dan@noemail.net>2020-07-13 18:04:27 +0000
commita7f82d9f47ca75a2f47dc14f8a8deb6730d718d0 (patch)
treee2000d1d8b1b14297c1a8790c65dd90c4a20e2b9 /ext/lsm1/lsm_unix.c
parent7465787b97a0a09841e343630a07ba80f1399e4a (diff)
parent5b107654e965973e68c88f90a09a3cc53bac9d8b (diff)
downloadsqlite-a7f82d9f47ca75a2f47dc14f8a8deb6730d718d0.tar.gz
sqlite-a7f82d9f47ca75a2f47dc14f8a8deb6730d718d0.zip
Merge latest trunk changes with this branch.
FossilOrigin-Name: 5ee3c27e20d12a126fb773b428bb864102b949a5b26a8d5c523753dcedf4be10
Diffstat (limited to 'ext/lsm1/lsm_unix.c')
-rw-r--r--ext/lsm1/lsm_unix.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/ext/lsm1/lsm_unix.c b/ext/lsm1/lsm_unix.c
index 22240771e..88952d15f 100644
--- a/ext/lsm1/lsm_unix.c
+++ b/ext/lsm1/lsm_unix.c
@@ -228,6 +228,10 @@ static int lsmPosixOsRemap(
}
p->pMap = mmap(0, iSz, PROT_READ|PROT_WRITE, MAP_SHARED, p->fd, 0);
+ if( p->pMap==MAP_FAILED ){
+ p->pMap = 0;
+ return LSM_IOERR_BKPT;
+ }
p->nMap = iSz;
}
@@ -413,7 +417,10 @@ static int lsmPosixOsShmMap(lsm_file *pFile, int iChunk, int sz, void **ppShm){
p->apShm[iChunk] = mmap(0, LSM_SHM_CHUNK_SIZE,
PROT_READ|PROT_WRITE, MAP_SHARED, p->shmfd, iChunk*LSM_SHM_CHUNK_SIZE
);
- if( p->apShm[iChunk]==0 ) return LSM_IOERR_BKPT;
+ if( p->apShm[iChunk]==MAP_FAILED ){
+ p->apShm[iChunk] = 0;
+ return LSM_IOERR_BKPT;
+ }
}
*ppShm = p->apShm[iChunk];