summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-09-27 03:46:03 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-09-27 03:46:03 +0000
commitfbfb3ec61af35c1850f2e5baec4a8fb3b1807e2c (patch)
treeeb183392ac5138a59cb8a23fc0175673885ff40b /src
parent8d28445b801c7e22ad266da2a672a59bee073112 (diff)
port mmap safety fix to efl tree.
SVN revision: 77115
Diffstat (limited to 'src')
-rw-r--r--src/lib/eina/eina_mmap.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/lib/eina/eina_mmap.c b/src/lib/eina/eina_mmap.c
index b99a542939..90809a23bb 100644
--- a/src/lib/eina/eina_mmap.c
+++ b/src/lib/eina/eina_mmap.c
@@ -164,10 +164,7 @@ eina_mmap_safety_enabled_set(Eina_Bool enabled)
164 sa.sa_sigaction = _eina_mmap_safe_sigbus; 164 sa.sa_sigaction = _eina_mmap_safe_sigbus;
165 sa.sa_flags = SA_RESTART | SA_SIGINFO; 165 sa.sa_flags = SA_RESTART | SA_SIGINFO;
166 sigemptyset(&sa.sa_mask); 166 sigemptyset(&sa.sa_mask);
167 /* FIXME: This is rubbish. We return EINA_FALSE whether sigaction 167 if (sigaction(SIGBUS, &sa, NULL) == 0) goto done;
168 * fails or not. And we never set mmap_safe, so we always hit this
169 * code path. */
170 if (sigaction(SIGBUS, &sa, NULL) == 0) return EINA_FALSE;
171 /* setup of SIGBUS handler failed, lets close zero page dev and fail */ 168 /* setup of SIGBUS handler failed, lets close zero page dev and fail */
172 close(_eina_mmap_zero_fd); 169 close(_eina_mmap_zero_fd);
173 _eina_mmap_zero_fd = -1; 170 _eina_mmap_zero_fd = -1;
@@ -176,8 +173,14 @@ eina_mmap_safety_enabled_set(Eina_Bool enabled)
176 else 173 else
177 { 174 {
178 /* reset signal handler to default for SIGBUS */ 175 /* reset signal handler to default for SIGBUS */
176 if (_eina_mmap_zero_fd >= 0)
177 {
178 close(_eina_mmap_zero_fd);
179 _eina_mmap_zero_fd = -1;
180 }
179 signal(SIGBUS, SIG_DFL); 181 signal(SIGBUS, SIG_DFL);
180 } 182 }
183done:
181 mmap_safe = enabled; 184 mmap_safe = enabled;
182 return mmap_safe; 185 return mmap_safe;
183#endif 186#endif