diff --git a/ChangeLog b/ChangeLog index 976cc42d04..599144ebbe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Jul 6 21:22:16 2011 KOSAKI Motohiro + + * cont.c (fiber_machine_stack_alloc): use MAP_FAILED instead of -1. + Wed Jul 6 21:21:05 2011 KOSAKI Motohiro * cont.c (fiber_machine_stack_alloc): remove unnecessary cast. diff --git a/cont.c b/cont.c index e260a40053..db4d93bca5 100644 --- a/cont.c +++ b/cont.c @@ -537,7 +537,7 @@ fiber_machine_stack_alloc(size_t size) void *page; STACK_GROW_DIR_DETECTION; ptr = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANON, -1, 0); - if (ptr == (VALUE*)(SIGNED_VALUE)-1) { + if (ptr == MAP_FAILED) { rb_raise(rb_eFiberError, "can't alloc machine stack to fiber"); } page = ptr + STACK_DIR_UPPER((size - RB_PAGE_SIZE) / sizeof(VALUE), 0);