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 Signed-off-by: Olivier Fourdan <[email protected]> --- v2: Replace previous patch reinstalling default signal handlers. hw/xwayland/xwayland.c | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/hw/xwayland/xwayland.c b/hw/xwayland/xwayland.c index 81e669cae..81fe5b2c7 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) { @@ -722,13 +738,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 @@ -755,7 +771,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)); } @@ -764,13 +780,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); } -- 2.14.3 _______________________________________________ [email protected]: X.Org development Archives: http://lists.x.org/archives/xorg-devel Info: https://lists.x.org/mailman/listinfo/xorg-devel
