[PATCH xserver] xwayland: handle EAGAIN and EINTR gracefully

Olivier Fourdan ofourdan at redhat.com
Mon Sep 12 15:28:42 UTC 2016


wl_display_flush() can fail with EAGAIN and Xwayland would make this a
fatal error.

Handle the usual EAGAIN and EINTR gracefully so that Xwayland doesn't
die for so little.

Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1278159
Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>
---
 hw/xwayland/xwayland.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 847321e..0c67cc8 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -496,7 +496,10 @@ xwl_dispatch_events (struct xwl_screen *xwl_screen)
 
     xwl_screen->prepare_read = 1;
 
-    ret = wl_display_flush(xwl_screen->display);
+    do {
+            ret = wl_display_flush(xwl_screen->display);
+    } while (ret == -1 && (errno == EINTR || errno == EAGAIN));
+
     if (ret == -1)
         FatalError("failed to write to XWayland fd: %s\n", strerror(errno));
 }
-- 
2.9.3



More information about the xorg-devel mailing list