aboutsummaryrefslogtreecommitdiffstats
path: root/src/alloc/alloc_mmap
diff options
context:
space:
mode:
Diffstat (limited to 'src/alloc/alloc_mmap')
-rw-r--r--src/alloc/alloc_mmap/mmap_mem.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/alloc/alloc_mmap/mmap_mem.cpp b/src/alloc/alloc_mmap/mmap_mem.cpp
index db9aff296..8ecb5f4fe 100644
--- a/src/alloc/alloc_mmap/mmap_mem.cpp
+++ b/src/alloc/alloc_mmap/mmap_mem.cpp
@@ -75,7 +75,9 @@ void* MemoryMapping_Allocator::alloc_block(u32bit n)
if(::unlink(file.path().c_str()))
throw MemoryMapping_Failed("Could not unlink file '" + file.path() + "'");
- ::lseek(file.get_fd(), n-1, SEEK_SET);
+ if(::lseek(file.get_fd(), n-1, SEEK_SET) < 0)
+ throw MemoryMapping_Failed("Could not seek file");
+
if(::write(file.get_fd(), "\0", 1) != 1)
throw MemoryMapping_Failed("Could not write to file");