diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-01 04:55:15 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-11-01 04:55:15 +0000 |
commit | 003e818fd63500770940873d8ccc48d6bbdea5f5 (patch) | |
tree | 5d35e97f65efa83ed31a6a591452049c0b193422 /libgo/runtime | |
parent | d772e63b2baad2b536c58e32a834755726813811 (diff) | |
download | gcc-003e818fd63500770940873d8ccc48d6bbdea5f5.tar.gz |
runtime: Correct test of mmap return value.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@180731 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/runtime')
-rw-r--r-- | libgo/runtime/mem.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libgo/runtime/mem.c b/libgo/runtime/mem.c index 4267c55fb47..4e1103e130a 100644 --- a/libgo/runtime/mem.c +++ b/libgo/runtime/mem.c @@ -85,6 +85,7 @@ void* runtime_SysReserve(void *v, uintptr n) { int fd = -1; + void *p; // On 64-bit, people with ulimit -v set complain if we reserve too // much address space. Instead, assume that the reservation is okay @@ -103,7 +104,11 @@ runtime_SysReserve(void *v, uintptr n) fd = dev_zero; #endif - return runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0); + p = runtime_mmap(v, n, PROT_NONE, MAP_ANON|MAP_PRIVATE, fd, 0); + if((uintptr)p < 4096 || -(uintptr)p < 4096) { + return nil; + } + return p; } void |