xserver: Branch 'master'

Adam Jackson ajax at kemper.freedesktop.org
Wed Dec 13 15:57:31 UTC 2017


 hw/xwayland/xwayland.c |   26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

New commits:
commit fe46cbea0f19959d469ca4d1f09be379dc7b1e45
Author: Olivier Fourdan <ofourdan at redhat.com>
Date:   Tue Nov 21 14:45:13 2017 +0100

    xwayland: Give up “cleanly“ on Wayland socket errors
    
    Xwayland is a pretty standard Wayland client, we want to be able to
    capture core dumps on crashes.
    
    Yet using "-core" causes any FatalError() to generate a core dump,
    meaning that we would get a core file for all Wayland server crashes,
    which would generate a lot of false positives.
    
    Instead of using FatalError() on Wayland socket errors, give up cleanly
    to avoid dumping core files when "-core" is used.
    
    See also: https://bugzilla.gnome.org/show_bug.cgi?id=790502
         and: https://bugzilla.gnome.org/show_bug.cgi?id=789086
    
    Reviewed-by: Adam Jackson <ajax at redhat.com>
    Signed-off-by: Olivier Fourdan <ofourdan at redhat.com>

diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c
index 638022180..c5a3ae7ae 100644
--- a/hw/xwayland/xwayland.c
+++ b/hw/xwayland/xwayland.c
@@ -73,6 +73,22 @@ ddxBeforeReset(void)
 }
 #endif
 
+ _X_NORETURN
+static void _X_ATTRIBUTE_PRINTF(1, 2)
+xwl_give_up(const char *f, ...)
+{
+    va_list args;
+
+    va_start(args, f);
+    VErrorFSigSafe(f, args);
+    va_end(args);
+
+    CloseWellKnownConnections();
+    OsCleanup(TRUE);
+    fflush(stderr);
+    exit(1);
+}
+
 void
 ddxUseMsg(void)
 {
@@ -719,13 +735,13 @@ xwl_read_events (struct xwl_screen *xwl_screen)
 
     ret = wl_display_read_events(xwl_screen->display);
     if (ret == -1)
-        FatalError("failed to read Wayland events: %s\n", strerror(errno));
+        xwl_give_up("failed to read Wayland events: %s\n", strerror(errno));
 
     xwl_screen->prepare_read = 0;
 
     ret = wl_display_dispatch_pending(xwl_screen->display);
     if (ret == -1)
-        FatalError("failed to dispatch Wayland events: %s\n", strerror(errno));
+        xwl_give_up("failed to dispatch Wayland events: %s\n", strerror(errno));
 }
 
 static int
@@ -752,7 +768,7 @@ xwl_dispatch_events (struct xwl_screen *xwl_screen)
            wl_display_prepare_read(xwl_screen->display) == -1) {
         ret = wl_display_dispatch_pending(xwl_screen->display);
         if (ret == -1)
-            FatalError("failed to dispatch Wayland events: %s\n",
+            xwl_give_up("failed to dispatch Wayland events: %s\n",
                        strerror(errno));
     }
 
@@ -761,13 +777,13 @@ xwl_dispatch_events (struct xwl_screen *xwl_screen)
 pollout:
     ready = xwl_display_pollout(xwl_screen, 5);
     if (ready == -1 && errno != EINTR)
-        FatalError("error polling on XWayland fd: %s\n", strerror(errno));
+        xwl_give_up("error polling on XWayland fd: %s\n", strerror(errno));
 
     if (ready > 0)
         ret = wl_display_flush(xwl_screen->display);
 
     if (ret == -1 && errno != EAGAIN)
-        FatalError("failed to write to XWayland fd: %s\n", strerror(errno));
+        xwl_give_up("failed to write to XWayland fd: %s\n", strerror(errno));
 
     xwl_screen->wait_flush = (ready == 0 || ready == -1 || ret == -1);
 }


More information about the xorg-commit mailing list