mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-18 21:29:19 +02:00
mmapped heaps: correctly check for mmap failure
When mmap fails it returns MAP_FAILED, not NULL. POSIX does not define the value for MAP_FAILED, but on at least the BSDs and Linux its value is ((void *) -1).
This commit is contained in:
parent
3749d29883
commit
650be6adc0
1 changed files with 2 additions and 1 deletions
3
gc.c
3
gc.c
|
@ -502,10 +502,11 @@ sexp_heap sexp_make_heap (size_t size, size_t max_size, size_t chunk_size) {
|
|||
#if SEXP_USE_MMAP_GC
|
||||
h = mmap(NULL, sexp_heap_pad_size(size), PROT_READ|PROT_WRITE|PROT_EXEC,
|
||||
MAP_ANON|MAP_PRIVATE, 0, 0);
|
||||
if (h == MAP_FAILED) return NULL;
|
||||
#else
|
||||
h = sexp_malloc(sexp_heap_pad_size(size));
|
||||
#endif
|
||||
if (! h) return NULL;
|
||||
#endif
|
||||
h->size = size;
|
||||
h->max_size = max_size;
|
||||
h->chunk_size = chunk_size;
|
||||
|
|
Loading…
Add table
Reference in a new issue