#ifdef _POSIX_MAPPED_FILES
// use anonymous mmap() to get the memory
Base = (unsigned char*) mmap(0, WorkSpace, PROT_READ|PROT_WRITE,
- MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
- if(Base != MAP_FAILED)
+ MAP_ANONYMOUS|MAP_PRIVATE, -1, 0);
+ if(Base == MAP_FAILED)
return;
-#endif
+#else
// fallback to a static allocated space
Base = new unsigned char[WorkSpace];
memset(Base,0,WorkSpace);
+#endif
iSize = 0;
}
/*}}}*/
if (Fd == 0)
{
#ifdef _POSIX_MAPPED_FILES
- munmap(Base, WorkSpace);
+ if(munmap(Base, WorkSpace) < 0)
#else
delete [] (unsigned char *)Base;
#endif