Util: Failed file mapping should return NULL on POSIX

This commit is contained in:
Vicki Pfau 2022-02-16 22:57:25 -08:00
parent cea11fadc4
commit 4312ce14ff
2 changed files with 6 additions and 1 deletions

View File

@ -39,6 +39,7 @@ Other fixes:
- FFmpeg: Fix GIF recording (fixes mgba.io/i/2393)
- GB: Fix temporary saves
- GB, GBA: Save writeback-pending masked saves on unload (fixes mgba.io/i/2396)
- VFS: Failed file mapping should return NULL on POSIX
Misc:
- Core: Suspend runloop when a core crashes
- GB Video: Add default SGB border

View File

@ -132,7 +132,11 @@ static void* _vfdMap(struct VFile* vf, size_t size, int flags) {
if (flags & MAP_WRITE) {
mmapFlags = MAP_SHARED;
}
return mmap(0, size, PROT_READ | PROT_WRITE, mmapFlags, vfd->fd, 0);
void* mapped = mmap(0, size, PROT_READ | PROT_WRITE, mmapFlags, vfd->fd, 0);
if (mapped == MAP_FAILED) {
return NULL;
}
return mapped;
}
static void _vfdUnmap(struct VFile* vf, void* memory, size_t size) {