From af59f4c1d4161770c276b5a0419c84f26d454f92 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 5 Aug 2014 11:45:25 -0700 Subject: [PATCH] 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 --- folly/IndexedMemPool.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/IndexedMemPool.h b/folly/IndexedMemPool.h index a668627e..d03c35c6 100644 --- a/folly/IndexedMemPool.h +++ b/folly/IndexedMemPool.h @@ -121,7 +121,7 @@ struct IndexedMemPool : boost::noncopyable { slots_ = static_cast(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(); } -- 2.34.1