summaryrefslogtreecommitdiff
path: root/src/lib/ecore_wayland
diff options
context:
space:
mode:
authorBoram Park <boram1288.park@samsung.com>2015-09-23 09:22:29 -0400
committerChris Michael <cp.michael@samsung.com>2015-09-23 09:22:29 -0400
commit3ebdfd8779d53c032649f52a69f0bc5b77999861 (patch)
tree0e6ba7c162a39b099745aec4264506223a084e03 /src/lib/ecore_wayland
parentf823d9c2ccb528f9df0a87a2d5ab13ae8a43ef47 (diff)
ecore_wl: abort if wl_display_dispatch returns negative value
Summary: If the connection between server and client has problems, wl_display_dispatch an return negative value. i.e. when enlightenment has been killed accidently. In this case, app can enter into infinite loop. Signed-off-by: Boram Park <boram1288.park@samsung.com> Reviewers: stefan_schmidt, zmike, gwanglim, raster, devilhorns Subscribers: cedric Differential Revision: https://phab.enlightenment.org/D3077
Diffstat (limited to 'src/lib/ecore_wayland')
-rw-r--r--src/lib/ecore_wayland/ecore_wl.c35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/lib/ecore_wayland/ecore_wl.c b/src/lib/ecore_wayland/ecore_wl.c
index 13758c6c3f..b9ad8543dd 100644
--- a/src/lib/ecore_wayland/ecore_wl.c
+++ b/src/lib/ecore_wayland/ecore_wl.c
@@ -121,8 +121,18 @@ _ecore_wl_init_callback(void *data, struct wl_callback *callback, uint32_t seria
121static void 121static void
122_ecore_wl_init_wait(void) 122_ecore_wl_init_wait(void)
123{ 123{
124 int ret;
124 while (!_ecore_wl_disp->init_done) 125 while (!_ecore_wl_disp->init_done)
125 wl_display_dispatch(_ecore_wl_disp->wl.display); 126 {
127 ret = wl_display_dispatch(_ecore_wl_disp->wl.display);
128 if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
129 {
130 /* raise exit signal */
131 ERR("Wayland socket error: %s", strerror(errno));
132 abort();
133 break;
134 }
135 }
126} 136}
127 137
128EAPI int 138EAPI int
@@ -262,10 +272,20 @@ ecore_wl_flush(void)
262EAPI void 272EAPI void
263ecore_wl_sync(void) 273ecore_wl_sync(void)
264{ 274{
275 int ret;
265 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return; 276 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return;
266 _ecore_wl_sync_wait(_ecore_wl_disp); 277 _ecore_wl_sync_wait(_ecore_wl_disp);
267 while (_ecore_wl_disp->sync_ref_count > 0) 278 while (_ecore_wl_disp->sync_ref_count > 0)
268 wl_display_dispatch(_ecore_wl_disp->wl.display); 279 {
280 ret = wl_display_dispatch(_ecore_wl_disp->wl.display);
281 if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
282 {
283 /* raise exit signal */
284 ERR("Wayland socket error: %s", strerror(errno));
285 abort();
286 break;
287 }
288 }
269} 289}
270 290
271EAPI struct wl_shm * 291EAPI struct wl_shm *
@@ -407,9 +427,18 @@ ecore_wl_dpi_get(void)
407EAPI void 427EAPI void
408ecore_wl_display_iterate(void) 428ecore_wl_display_iterate(void)
409{ 429{
430 int ret;
410 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return; 431 if ((!_ecore_wl_disp) || (!_ecore_wl_disp->wl.display)) return;
411 if (!_ecore_wl_server_mode) 432 if (!_ecore_wl_server_mode)
412 wl_display_dispatch(_ecore_wl_disp->wl.display); 433 {
434 ret = wl_display_dispatch(_ecore_wl_disp->wl.display);
435 if ((ret < 0) && ((errno != EAGAIN) && (errno != EINVAL)))
436 {
437 /* raise exit signal */
438 ERR("Wayland socket error: %s", strerror(errno));
439 abort();
440 }
441 }
413} 442}
414 443
415/* @since 1.8 */ 444/* @since 1.8 */