correct mmap error check

Update mmap error validation to check for MAP_FAILED instead of NULL.
POSIX specifies that mmap returns MAP_FAILED (-1) on failure.
This commit is contained in:
richardsonnick
2026-02-27 17:40:26 -05:00
committed by Nick Terrell
parent 2107c8f189
commit bb1eedcf86
+3 -1
View File
@@ -1050,7 +1050,9 @@ static size_t FIO_setDictBufferMMap(FIO_Dict_t* dict, const char* fileName, FIO_
}
*bufferPtr = mmap(NULL, (size_t)fileSize, PROT_READ, MAP_PRIVATE, fileHandle, 0);
if (*bufferPtr==NULL) EXM_THROW(34, "%s", strerror(errno));
if (*bufferPtr == MAP_FAILED) {
EXM_THROW(34, "%s", strerror(errno))
}
close(fileHandle);
return (size_t)fileSize;