diff options
author | lloyd <[email protected]> | 2009-03-27 20:06:17 +0000 |
---|---|---|
committer | lloyd <[email protected]> | 2009-03-27 20:06:17 +0000 |
commit | d323e4f3b9536f9a359fb8590234339e9d1988d2 (patch) | |
tree | 0d369b12dd0d283516ee0e125e730001b8001e64 /src/alloc/alloc_mmap/mmap_mem.cpp | |
parent | 3accc2eee41abb01aa9fdb88f426fd96098d0a0e (diff) |
Check the return value of lseek in the mmap allocator
Diffstat (limited to 'src/alloc/alloc_mmap/mmap_mem.cpp')
-rw-r--r-- | src/alloc/alloc_mmap/mmap_mem.cpp | 4 |
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"); |