From db30615bcb3b872475e7d40eeee8cdda5b723078 Mon Sep 17 00:00:00 2001 From: Jeremy Huddleston Date: Mon, 10 Oct 2011 12:16:31 -0700 Subject: [PATCH] Xephyr: Remove socket and its lock file on exit https://bugs.freedesktop.org/show_bug.cgi?id=11484 Signed-off-by: Jeremy Huddleston Reviewed-by: Mikhail Gusarov --- hw/kdrive/ephyr/hostx.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/hw/kdrive/ephyr/hostx.c b/hw/kdrive/ephyr/hostx.c index 4caf4516d..47a6681c4 100644 --- a/hw/kdrive/ephyr/hostx.c +++ b/hw/kdrive/ephyr/hostx.c @@ -45,6 +45,7 @@ #include #include #include /* for memset */ +#include #include #include @@ -331,6 +332,14 @@ hostx_set_title (char *title) ephyrTitle = title; } +static int _X_NORETURN +x_io_error_handler (Display *dpy) { + ErrorF("Lost connection to X server: %s\n", strerror(errno)); + CloseWellKnownConnections(); + OsCleanup(1); + exit(1); +} + int hostx_init (void) { @@ -358,6 +367,8 @@ hostx_init (void) exit(1); } + XSetIOErrorHandler(x_io_error_handler); + HostX.screen = DefaultScreen(HostX.dpy); HostX.winroot = RootWindow(HostX.dpy, HostX.screen); HostX.gc = XCreateGC(HostX.dpy, HostX.winroot, 0, NULL);