diff options
Diffstat (limited to 'src/lib/eina/eina_mmap.c')
-rw-r--r-- | src/lib/eina/eina_mmap.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/lib/eina/eina_mmap.c b/src/lib/eina/eina_mmap.c index 11d8804759..23386dac1d 100644 --- a/src/lib/eina/eina_mmap.c +++ b/src/lib/eina/eina_mmap.c | |||
@@ -198,10 +198,16 @@ eina_mmap_safety_enabled_set(Eina_Bool enabled) | |||
198 | /* no zero page device - open it */ | 198 | /* no zero page device - open it */ |
199 | if (_eina_mmap_zero_fd < 0) | 199 | if (_eina_mmap_zero_fd < 0) |
200 | { | 200 | { |
201 | #ifdef HAVE_OPEN_CLOEXEC | ||
202 | _eina_mmap_zero_fd = open("/dev/zero", O_RDWR | O_CLOEXEC); | ||
203 | /* if we don;'t have one - fail to set up mmap safety */ | ||
204 | if (_eina_mmap_zero_fd < 0) return EINA_FALSE; | ||
205 | #else | ||
201 | _eina_mmap_zero_fd = open("/dev/zero", O_RDWR); | 206 | _eina_mmap_zero_fd = open("/dev/zero", O_RDWR); |
202 | /* if we don;'t have one - fail to set up mmap safety */ | 207 | /* if we don;'t have one - fail to set up mmap safety */ |
203 | if (_eina_mmap_zero_fd < 0) return EINA_FALSE; | 208 | if (_eina_mmap_zero_fd < 0) return EINA_FALSE; |
204 | eina_file_close_on_exec(_eina_mmap_zero_fd, EINA_TRUE); | 209 | eina_file_close_on_exec(_eina_mmap_zero_fd, EINA_TRUE); |
210 | #endif | ||
205 | } | 211 | } |
206 | /* set up signal handler for SIGBUS */ | 212 | /* set up signal handler for SIGBUS */ |
207 | sa.sa_sigaction = _eina_mmap_safe_sigbus; | 213 | sa.sa_sigaction = _eina_mmap_safe_sigbus; |