Commit af59f4c1 authored by Jim Meyering's avatar Jim Meyering Committed by Sara Golemon

folly/IndexedMemPool: correct an erroneous test for failed mmap

Summary:
* folly/IndexedMemPool.h (IndexedMemPool): Correct the test for
failed mmap.  Upon failure, it returns MAP_FAILED, not nullptr.

Test Plan:
fbconfig -r folly/test:indexed_mem_pool_test && fbmake runtests

Reviewed By: ngbronson@fb.com

FB internal diff: D1480389

Tasks: 4846893
@override-unit-failures
parent 7ce33845
......@@ -121,7 +121,7 @@ struct IndexedMemPool : boost::noncopyable {
slots_ = static_cast<Slot*>(mmap(nullptr, mmapLength_,
PROT_READ | PROT_WRITE,
MAP_PRIVATE | MAP_ANONYMOUS, -1, 0));
if (slots_ == nullptr) {
if (slots_ == MAP_FAILED) {
assert(errno == ENOMEM);
throw std::bad_alloc();
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment