[Ecls-list] Patch: fix mmap() in _ecl_alloc_env()
Josh Elsasser
josh at elsasser.org
Sat Jan 24 21:03:56 UTC 2009
When mapping anonymous memory, the file descriptor argument should be
-1, not 0. On my system at least, passing 0 causes mmap to fail. The
check for mmap failure also did not work for me.
diff --git src/c/main.d src/c/main.d
index 9b63fa0..c48427b 100644
--- src/c/main.d
+++ src/c/main.d
@@ -212,8 +212,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 == -1)
ecl_internal_error("Unable to allocate environment structure.");
#else
output = ecl_alloc(sizeof(*output));
More information about the ecl-devel
mailing list