SQLite Forum

Bug: Wrong/missing return value check of mmap function in lsm_unix.c
> There is a wrong/missing return value check of the mmap function in the file lsm_unix.c. The return value is checked against 0, but mmap returns MAP_FAILED (-1) on errors. 

[`mmap()` returns a pointer][mmap], and 0 is equivalent to a `NULL` pointer.

Edit: nevermind. the man page clearly says that it returns a `(void*)-1`... which is weird, but okay. Sorry for the noise.

[mmap]: https://man7.org/linux/man-pages/man2/mmap.2.html