folly/IndexedMemPool: correct an erroneous test for failed mmap
authorJim Meyering <meyering@fb.com>
Tue, 5 Aug 2014 18:45:25 +0000 (11:45 -0700)
committerSara Golemon <sgolemon@fb.com>
Thu, 14 Aug 2014 18:49:04 +0000 (11:49 -0700)
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

index a668627ed817ee54562585a84ba9d3b36cd967a7..d03c35c65cc574a3a80ef7375de61324d8cbb58a 100644 (file)
@@ -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();
     }