From 2c62153351eac55a28e9baee201cd4aca25d9595 Mon Sep 17 00:00:00 2001 From: Ivan Maidanski Date: Fri, 19 Oct 2012 09:10:07 +0400 Subject: [PATCH] Fix GC_unix_mmap_get_mem for open of /dev/zero failure * os_dep.c (GC_unix_mmap_get_mem): Check open("/dev/zero") (or open of similar file on Symbian) result and abort (with the appropriate message) on failure (only if USE_MMAP_ANON is undefined). --- os_dep.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/os_dep.c b/os_dep.c index 2524c864..eb6b846c 100644 --- a/os_dep.c +++ b/os_dep.c @@ -2091,6 +2091,9 @@ STATIC ptr_t GC_unix_mmap_get_mem(word bytes) # else zero_fd = open("/dev/zero", O_RDONLY); # endif + if (zero_fd == -1) + ABORT("Could not open /dev/zero"); + fcntl(zero_fd, F_SETFD, FD_CLOEXEC); initialized = TRUE; } -- 2.40.0