Fix wrong return value check of mmap function