mirror of
https://github.com/facebook/zstd
synced 2026-08-22 22:32:07 -04:00
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:
parent
2107c8f189
commit
bb1eedcf86
1 changed files with 3 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue