From a40ed5054ce44debf13de332baa167e986326cd0 Mon Sep 17 00:00:00 2001 From: Juan Jose Garcia Ripoll Date: Tue, 27 Jan 2009 21:55:15 +0100 Subject: [PATCH] Failure of mmap() is signaled by MAP_FAIL (Posix), but in some platforms it is not defined and specified as -1 --- src/c/main.d | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/c/main.d b/src/c/main.d index c3e8087ae..5d274e51b 100644 --- a/src/c/main.d +++ b/src/c/main.d @@ -34,6 +34,9 @@ #endif #ifdef ECL_USE_MPROTECT # include +# ifndef MAP_FAIL +# define MAP_FAIL -1 +# endif #endif #include #include @@ -212,8 +215,8 @@ _ecl_alloc_env() cl_env_ptr output; #if defined(ECL_USE_MPROTECT) output = mmap(0, sizeof(*output), PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PRIVATE, 0, 0); - if (output < 0) + MAP_ANON | MAP_PRIVATE, -1, 0); + if (output == MAP_FAIL) ecl_internal_error("Unable to allocate environment structure."); #else output = ecl_alloc(sizeof(*output));