summaryrefslogtreecommitdiff
path: root/lib/Handle.cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Handle.cc')
-rw-r--r--lib/Handle.cc8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/Handle.cc b/lib/Handle.cc
index 8ec6219..84004b0 100644
--- a/lib/Handle.cc
+++ b/lib/Handle.cc
@@ -29,6 +29,10 @@ inline Uint32 bswap_32(Uint32 w) {
#include <io.h>
#endif
+#ifndef _WIN32
+#include <sys/mman.h>
+#endif
+
#include "Handle.h"
#include "gettext.h"
@@ -535,10 +539,10 @@ void * Handle::mmap(off_t offset, size_t length) throw (GeneralException) {
throw GeneralException("Handle already mmap()ped");
}
mapped = true;
- maplength = length;
if (length == -1) {
length = GetSize();
}
+ maplength = length;
#ifndef _WIN32
r = ::mmap(0, length, (CanRead() ? PROT_READ : 0) | (CanWrite() ? PROT_WRITE : 0), MAP_SHARED, h, offset);
if (!r) {
@@ -578,7 +582,7 @@ void Handle::munmap() throw (GeneralException) {
throw GeneralException("Can't munmap, was not mapped");
}
#ifndef _WIN32
- if (::munmap(mappedarea, maplength) {
+ if (::munmap(mappedarea, maplength)) {
throw GeneralException(String("Was not able to munmap(): ") + strerror(errno));
}
#else