MemoryBuffer.cpp: Consider if PageSize were not 4096 in shouldUseMmap(). Follow-up...
[oota-llvm.git] / lib / Support / MemoryBuffer.cpp
index cab45c736b51e5fe585d208a87aea26fb3809272..1c45c69ff3f5b6e2d568b7868615a1c06aa5dc0d 100644 (file)
@@ -276,7 +276,7 @@ static bool shouldUseMmap(int FD,
                           int PageSize) {
   // We don't use mmap for small files because this can severely fragment our
   // address space.
-  if (MapSize < 4096*4)
+  if (MapSize < 4 * 4096 || MapSize < (unsigned)PageSize)
     return false;
 
   if (!RequiresNullTerminator)